<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Paul Bain</title>
	<atom:link href="http://www.paulbain.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paulbain.com</link>
	<description>Software Engineer</description>
	<lastBuildDate>Wed, 20 Feb 2013 22:38:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Minimum Viable Product &#8211; a definiation</title>
		<link>http://www.paulbain.com/2011/11/01/minimum-viable-product-a-definiation/</link>
		<comments>http://www.paulbain.com/2011/11/01/minimum-viable-product-a-definiation/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 14:57:04 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=702</guid>
		<description><![CDATA[Over the past couple of weeks I&#8217;ve been lecturing at UK universities giving a practical overview of how we use the Minimum Viable Product (MVP) approach at Next Jump. I like Eric Reis&#8217; definition but it doesn&#8217;t quite describe how &#8230; <a href="http://www.paulbain.com/2011/11/01/minimum-viable-product-a-definiation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Over the past couple of weeks I&#8217;ve been lecturing at UK universities giving a practical overview of how we use the Minimum Viable Product (MVP) approach at <a href="http://www.nextjump.com">Next Jump</a>. I like <a href="http://www.startuplessonslearned.com/2009/08/minimum-viable-product-guide.html">Eric Reis&#8217; </a>definition but it doesn&#8217;t quite describe how the MVP process works for us in practice, so I thought I&#8217;d share how I described it:</p>
<blockquote><p>The Minimum Viable Product is one which only allows features that are absolutely required, to be released to a population of real users from which measures of success and failure can be observed, feedback gathered and iterative improvements made.</p></blockquote>
<p>They key concepts are:</p>
<ul>
<li><strong>The Minimum number of features</strong>, and the minimum is probably fewer that you think.</li>
<li><strong>Measurable results</strong>, which enable you to statistically analyse and quantify performance of iterations.</li>
<li><strong>User feedback, </strong>which gives you a true insight into how users are interacting with your product, what works and what doesn&#8217;t<strong>.</strong></li>
<li><strong>An Iterative Process</strong>, as without iterations your product will never move from minimum viability towards an optimal solution.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2011/11/01/minimum-viable-product-a-definiation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing Commission Junction&#8217;s API with Java</title>
		<link>http://www.paulbain.com/2011/04/21/accessing-commission-junctions-api-with-java/</link>
		<comments>http://www.paulbain.com/2011/04/21/accessing-commission-junctions-api-with-java/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 09:50:32 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Java Development]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=684</guid>
		<description><![CDATA[I couldn&#8217;t find a good example of how to connect to the CJ API with Java, so here is stripped down version of how I did it: import java.net.*; import java.io.*; &#160; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; &#160; import org.w3c.dom.Document; &#160; &#8230; <a href="http://www.paulbain.com/2011/04/21/accessing-commission-junctions-api-with-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t find a good example of how to connect to the CJ API with Java, so here is stripped down version of how I did it:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.xml.parsers.DocumentBuilder</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.xml.parsers.DocumentBuilderFactory</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.w3c.dom.Document</span><span style="color: #339933;">;</span>
&nbsp;
...
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">Document</span> getCommissionDetail<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> startDate, <span style="color: #003399;">String</span> endDate<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">String</span> response <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> devKey <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;YOUR-DEV-KEY&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">Document</span> doc <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> urlPath <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;https://commission-detail.api.cj.com/v3/commissions?date-type=event&amp;amp;start-date=&quot;</span> <span style="color: #339933;">+</span> startDate <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&amp;amp;end-date=&quot;</span> <span style="color: #339933;">+</span> endDate<span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">URL</span> u <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">URLConnection</span> uc <span style="color: #339933;">=</span> u.<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">HttpURLConnection</span> connection <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">HttpURLConnection</span><span style="color: #009900;">&#41;</span> uc<span style="color: #339933;">;</span>
        connection.<span style="color: #006633;">setRequestMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;GET&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        connection.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authorization&quot;</span>, devKey<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
        connection.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span>,<span style="color: #0000ff;">&quot;text/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        connection.<span style="color: #006633;">setDoInput</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        DocumentBuilderFactory dbf <span style="color: #339933;">=</span> DocumentBuilderFactory.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        DocumentBuilder db <span style="color: #339933;">=</span> dbf.<span style="color: #006633;">newDocumentBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        doc <span style="color: #339933;">=</span> db.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span>connection.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        doc.<span style="color: #006633;">getDocumentElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">normalize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//Something went wrong with the request</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//Something went wrong, very wrong</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> doc<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Leave a comment if you find it useful or use it in a project!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2011/04/21/accessing-commission-junctions-api-with-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Show Whitespace Characters in Eclipse</title>
		<link>http://www.paulbain.com/2011/04/05/show-whitespace-characters-in-eclipse/</link>
		<comments>http://www.paulbain.com/2011/04/05/show-whitespace-characters-in-eclipse/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 15:31:47 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=681</guid>
		<description><![CDATA[Eclipse seems to make it really easy to add extra whitespace characters for some reason! To make Eclipse show whitespace characters you just need to go to: Window&#62;Preferences&#62;General&#62;Editors&#62;Text Editors]]></description>
			<content:encoded><![CDATA[<p>Eclipse seems to make it really easy to add extra whitespace characters for some reason!</p>
<p>To make Eclipse show whitespace characters you just need to go to: Window&gt;Preferences&gt;General&gt;Editors&gt;Text Editors</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2011/04/05/show-whitespace-characters-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fast Plist Creation in PHP</title>
		<link>http://www.paulbain.com/2011/03/30/fast-plist-creation-in-php/</link>
		<comments>http://www.paulbain.com/2011/03/30/fast-plist-creation-in-php/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 13:00:32 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=644</guid>
		<description><![CDATA[When we originally designed the BeerMap API we decided to provide the data in a plist format, along with json and XML. The plist format isn&#8217;t widely used for APIs, however iOS provides efficient inbuilt parsing of this file type &#8230; <a href="http://www.paulbain.com/2011/03/30/fast-plist-creation-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When <a href="http://iphone.galloway.me.uk">we</a> originally designed the <a href="http://www.beermap.co">BeerMap</a> API we decided to provide the data in a <a href="http://en.wikipedia.org/wiki/Property_list">plist </a>format, along with json and XML.</p>
<p>The plist format isn&#8217;t widely used for APIs, however iOS provides efficient inbuilt parsing of this file type and we also found this to be much easier to implement in terms of code complexity.</p>
<p>For example, you can just do this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSDictionary</span><span style="color: #002200;">*</span> dict <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> dictionaryWithContentsOfURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.example.com/data.plist&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>For the past two years we&#8217;ve used the <a href="https://github.com/rodneyrehm/CFPropertyList">CFPropertyList library</a> which in my opinion is the best and most functional library for reading and writing plist files in PHP.</p>
<p>If you find issues, please post on <a href="https://github.com/paulbain/Bain-PHP-Library/issues">Github</a>, or even better, fork and create a pull request!</p>
<p>However, in BeerMap we just need to create and output plists as fast as we can without any need to read or represent them in an object format. Looking at the xdebug output for the BeerMap API it became evident that the plist creation was by far the biggest bottleneck, mostly because of the XML object representation.</p>
<p>So, in summary I&#8217;ve created a quick class which just generates an XML string from an associative array instead of using XML objects. From my testing using <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">ab</a>, I was getting almost twice the number of request per second.</p>
<p>You can find the code at <a href="https://github.com/paulbain/Bain-PHP-Library">Github &#8211; https://github.com/paulbain/Bain-PHP-Library</a> where I&#8217;ve started a library in the Zend Framework layout.</p>
<p>Here&#8217;s an example of how to use it:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Plist.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get some data in an associative array</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'reviews'</span><span style="color: #339933;">=&gt;;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;;</span><span style="color: #0000ff;">'My Review'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment'</span><span style="color: #339933;">=&gt;;</span><span style="color: #0000ff;">'It\'s awesome'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'rating'</span><span style="color: #339933;">=&gt;;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Specifiy types for any non-string named keys</span>
<span style="color: #000088;">$types</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'rating'</span><span style="color: #339933;">=&gt;;</span><span style="color: #0000ff;">'real'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Create the Plist</span>
<span style="color: #000088;">$plist</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Bain_Plist<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span><span style="color: #000088;">$types</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Output the plist! (Maybe you'll need an XML header)</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$plist</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you&#8217;re using the Zend Framework auto loader, just place the library in your path and register the namespace:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$autoloader</span> <span style="color: #339933;">=</span> Zend_Loader_Autoloader<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$autoloader</span><span style="color: #339933;">-&gt;;</span>registerNamespace<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Bain_'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you use this in a project leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2011/03/30/fast-plist-creation-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Speeding up CURL Requests in PHP</title>
		<link>http://www.paulbain.com/2011/03/29/speeding-up-curl-requests-in-php/</link>
		<comments>http://www.paulbain.com/2011/03/29/speeding-up-curl-requests-in-php/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 15:30:28 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=632</guid>
		<description><![CDATA[Recently I&#8217;ve been working with an extremely data intensive flight API which takes several seconds to process a response and up to 60 seconds to transfer the data. Unfortunately there is no way to reduce the amount of content in &#8230; <a href="http://www.paulbain.com/2011/03/29/speeding-up-curl-requests-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working with an extremely data intensive flight API which takes several seconds to process a response and up to 60 seconds to transfer the data.</p>
<p>Unfortunately there is no way to reduce the amount of content in the response which would have been the best optimisation. A good hint in cases like these is to try to get the server to compress the content. Using one simple CURL option I was able to speed up each request by around 40 seconds, extremely satisfying!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span>CURLOPT_ENCODING<span style="color: #339933;">,</span><span style="color: #0000ff;">'gzip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you&#8217;re actually creating the API using PHP, you may want to look at tweaking your php.ini settings to make sure <a title="zlib at PHP.net" href="http://www.php.net/manual/en/intro.zlib.php">zlib </a>output compression is enabled.<br />
You can also play with the output compression level, with 1 being the lowest and 9 the highest. Be careful however as a higher level of compression may result in high server load.</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">zlib.output_compression <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> On</span>
zlib.output_compression_level <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 6</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2011/03/29/speeding-up-curl-requests-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EasyTube Plugin Updated</title>
		<link>http://www.paulbain.com/2009/11/05/easytube-plugin-updated/</link>
		<comments>http://www.paulbain.com/2009/11/05/easytube-plugin-updated/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 20:50:46 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=220</guid>
		<description><![CDATA[I've just released an update to EasyTube which is my most popular WordPress plugin which allows people to embed YouTube videos in posts and pages using a single tag. <a href="http://www.paulbain.com/2009/11/05/easytube-plugin-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just released an update to EasyTube which is my most popular WordPress plugin that allows people to embed YouTube videos in posts and pages using a single tag.</p>
<h4>Version 1.7 update includes:</h4>
<ul>
<li>Multiple bug fixes including a major problem with video sizes</li>
<li>Addition of new widescreen video formats</li>
<li>Updated embed to include the fullscreen option</li>
</ul>
<p>For more information visit the <a href="http://wordpress.org/extend/plugins/easytube/">WordPress.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2009/11/05/easytube-plugin-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pay What You Want iPhone Business Model</title>
		<link>http://www.paulbain.com/2009/10/26/pay-what-you-want-iphone-business-model/</link>
		<comments>http://www.paulbain.com/2009/10/26/pay-what-you-want-iphone-business-model/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 18:00:50 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[BeerMap]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=172</guid>
		<description><![CDATA[Apple recently updated their SDK allowing developers to integrate in-app purchases into free applications opening up a whole new world of possibilities. BeerMap, one of the projects [...] <a href="http://www.paulbain.com/2009/10/26/pay-what-you-want-iphone-business-model/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Apple recently updated their SDK allowing developers to integrate in-app purchases into free applications opening up a whole new world of possibilities.</p>
<p>BeerMap, one of the projects I&#8217;m currently involved with is a free iPhone app which we have always intended to monetise once it reached maturity. We&#8217;ve recently started to discuss charging in iTunes however it gave us a few concerns:</p>
<ol>
<li>The application relies on user collaboration in order to generate data, charging for the application would probably reduce the uptake by new users.</li>
<li>The application will take some time to reach maturity and is dependant on the feedback of our loyal user base.</li>
</ol>
<p>We therefore have resisted charging for the app and instead have begun to investigate other avenues.</p>
<p>Last Saturday was a BeerMap development day during which we discussed the possibility of monetisation using in-app purchases and we think we may have come up with a novel solution; <strong>Pay What You Want</strong>.</p>
<p>Pay What You Want is not a new concept; in 2007 Radiohead allowed music lovers to download their new album and choose how much they want to pay. More recently 2D Boy used the same model when celebrating the first birthday of World of Goo, achieving a large number of sales and yielding a surprising profit.</p>
<p>Combining pay what you want and in-app purchase capability in BeerMap would allow users to decide whether they want to pay for the app or not! Apple provides payment tiers to which we will be limited so it won&#8217;t be 100% pay what you want, however these represent reasonable prices which users will be familiar with.</p>
<p>We plan to incentivise payment, potentially by giving the user access to extra features or awarding them recognition within the BeerMap community.</p>
<p>We hope this model will ensure we don&#8217;t scare off new users who don&#8217;t want to and will never want to pay, while providing people with the option to support the project and to show appreciation for our work.</p>
<p><em>Image credit: <strong><a href="http://www.flickr.com/photos/osterwalder/"><strong>Alex Osterwalder</strong></a></strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2009/10/26/pay-what-you-want-iphone-business-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snow Leopard, Zend Framework and MySQLi Problem</title>
		<link>http://www.paulbain.com/2009/10/20/snow-leopard-zend-framework-and-mysqli-problem/</link>
		<comments>http://www.paulbain.com/2009/10/20/snow-leopard-zend-framework-and-mysqli-problem/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 20:54:53 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=154</guid>
		<description><![CDATA[I spent a good hour banging my head against the desk this evening trying to work out why Zend Framework row objects have stopped working after upgrading to Snow Leopard and installing the new iPhone SDK [...] <a href="http://www.paulbain.com/2009/10/20/snow-leopard-zend-framework-and-mysqli-problem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I spent a good hour banging my head against the desk this evening trying to work out why Zend Framework row objects have stopped working after upgrading to Snow Leopard and installing the new iPhone SDK.</p>
<p>I traced all the way though to the Zend_Db_Statement_Mysqli class which giving the following error:</p>
<pre>Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in Zend/Db/Statement/Mysqli.php on line 205</pre>
<p>I was half way installing the macports PHP package when I thought I should probably try a different adapter which worked! So if you&#8217;re having difficulties, try the PDO_MYSQL driver instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2009/10/20/snow-leopard-zend-framework-and-mysqli-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTO: Draggabe JFrame Without Decoration</title>
		<link>http://www.paulbain.com/2009/10/13/howto-draggabe-jframe-without-decoration/</link>
		<comments>http://www.paulbain.com/2009/10/13/howto-draggabe-jframe-without-decoration/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 10:34:25 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Efficiency]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=122</guid>
		<description><![CDATA[I was playing with writing a quick time tracking application called Efficiency which needed to be always ontop of other windows and therefore be a subtle as possible. I therefore decided to undecorate the window, however the user is then &#8230; <a href="http://www.paulbain.com/2009/10/13/howto-draggabe-jframe-without-decoration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was playing with writing a quick time tracking application called Efficiency which needed to be always ontop of other windows and therefore be a subtle as possible. I therefore decided to undecorate the window, however the user is then unable to reposition the window, so I wrote a some code to quickly allow them to do this by just dragging the JFrame.</p>
<p>My class extends the javax.swing.JFrame class, so I&#8217;ve set a few properties in the initComponents() function and more importantly added listeners for MousePressed and MouseDragged.</p>
<pre>    private void initComponents() {
        ...
        setAlwaysOnTop(true);
        setBackground(new java.awt.Color(0, 0, 0));
        setResizable(false);
        setUndecorated(true);
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                formMousePressed(evt);
            }
        });
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                formMouseDragged(evt);
            }
        });
        ...
    }</pre>
<p>Firing an action on mousePressed is required to get the original location of the window. This fires the following function, setting the two variables which are of type java.awt.Point:</p>
<pre>    private void formMousePressed(java.awt.event.MouseEvent evt) {
        this.start_drag = this.getScreenLocation(evt);
        this.start_loc = this.getLocation();
    }</pre>
<p>The mouse dragged function is as follows:</p>
<pre>    private void formMouseDragged(java.awt.event.MouseEvent evt) {
            Point current = this.getScreenLocation(evt);
    Point offset = new Point((int) current.getX() - (int) start_drag.getX(),
        (int) current.getY() - (int) start_drag.getY());

    Point new_location = new Point(
        (int) (this.start_loc.getX() + offset.getX()), (int) (this.start_loc
            .getY() + offset.getY()));
        this.setLocation(new_location);
    }</pre>
<p>You&#8217;ll also need the utilty funciton to convert the points to a screen location:</p>
<pre>      Point getScreenLocation(MouseEvent e) {
        Point cursor = e.getPoint();
        Point target_location = this.getLocationOnScreen();
        return new Point((int) (target_location.getX() + cursor.getX()),
            (int) (target_location.getY() + cursor.getY()));
      }</pre>
<h3>Reference</h3>
<ul>
<li><a href="http://www.java2s.com/Code/Java/Swing-JFC/Dragandmoveaframefromitscontentarea.htm">Drag and Move</a> &#8211; material from java2s.com used as a basis but using an external MoveMouseListner class</li>
</ul>
<p><em>Photo Credit: <a title="Link to dongga BS' photostream" rel="dc:creator cc:attributionURL" href="http://www.flickr.com/photos/dongga/">dongga BS</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2009/10/13/howto-draggabe-jframe-without-decoration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inserting Default Content into the WordPress Visual Editor</title>
		<link>http://www.paulbain.com/2009/10/08/inserting-default-content-into-wordpress-visual-editor/</link>
		<comments>http://www.paulbain.com/2009/10/08/inserting-default-content-into-wordpress-visual-editor/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 22:20:25 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.paulbain.com/?p=112</guid>
		<description><![CDATA[I&#8217;ve been working on a WordPress layout which needs two columns of user editable content per page. There are many ways you could do this with WordPress, however to make it as easy as possible for the content editors I &#8230; <a href="http://www.paulbain.com/2009/10/08/inserting-default-content-into-wordpress-visual-editor/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a WordPress layout which needs two columns of user editable content per page. There are many ways you could do this with WordPress, however to make it as easy as possible for the content editors I though it would be easier if the visual editor had some default layout information inserted when creating a post.</p>
<p>I knew there must be an easy way to do this using the action API in WordPress and I came across <a href="http://www.wprecipes.com/how-to-automatically-insert-text-in-wordpress-editor">this article</a> by WPRecipies which suggests putting the following code in the functions.php of your theme:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'default_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_editor_content'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_editor_content<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$content</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;If you enjoyed this post, make sure to subscribe to my rss feed.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I inserted a couple of divs for the columns into mine so I also wanted to add some basic styling to the editor. I know this probably isn&#8217;t the best way and I&#8217;m sure someone will correct me, but I just added the style to the end of the TinyMCE stylesheet which can be found here in /wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css</p>
<p><em><strong>EDIT:</strong> you can do this for custom post types too, just change the &#8220;myposttype&#8221; to be set to your type:</em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'default_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_editor_content'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_editor_content<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post_type</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_type</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'myposttype'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;If you enjoyed this post, make sure to subscribe to my rss feed.&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.paulbain.com/2009/10/08/inserting-default-content-into-wordpress-visual-editor/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
