<?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>James Pearce &#187; Mobile Web</title>
	<atom:link href="http://tripleodeon.com/category/mobile-web/feed/" rel="self" type="application/rss+xml" />
	<link>http://tripleodeon.com</link>
	<description>Living the mobile dream</description>
	<lastBuildDate>Mon, 30 Aug 2010 06:42:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<cloud domain='tripleodeon.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Mobile Analytics With Python, Django, ASP.NET, Java, and node.js</title>
		<link>http://tripleodeon.com/2010/08/mobile-analytics-with-python-django-asp-net-java-and-node-js/</link>
		<comments>http://tripleodeon.com/2010/08/mobile-analytics-with-python-django-asp-net-java-and-node-js/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 06:42:30 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=380</guid>
		<description><![CDATA[A few weeks ago, the PercentMobile team came to me to see if I could help write some new libraries for them. Contemporary web and mobile web sites are written on a vast array of different platforms… and obviously the more that PercentMobile supports, the better. Something I love about programming is that there are [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago, the <a href="http://percentmobile.com">PercentMobile</a> team came to me to see if I could help write some new libraries for them. Contemporary web and mobile web sites are written on a vast array of different platforms… and obviously the more that PercentMobile supports, the better.</p>
<p>Something I love about programming is that there are so many languages to choose from &#8211; why restrict yourself to learning or becoming an expert at one when the same problems are also being solved in other, sometimes better, ways? Each language or platform has strengths and weaknesses of course. But I believe that understanding the differences &#8211; and more often, the similarities &#8211; makes one a better programmer.</p>
<p>So, generous polyglot that I am, I took the challenge, and plunged in.</p>
<p>(Sign up for the free PercentMobile service to get the libraries described in this post.)</p>
<h2>Python &amp; Django</h2>
<p>I love <a href="http://python.org" target="_blank">Python</a> &#8211; its readability, its libraries, and its overall philosophies. In a web server environment, Python can be used in a fairly raw way, behind a generic Web Service Gateway Interface (WSGI), but there are also a number of powerful web application frameworks using the language &#8211; most notably <a href="http://djangoproject.com/" target="_blank">Django</a>. PercentMobile want to provide painless Django support, but also to make sure that other Python server environments were not precluded.</p>
<p><code>percentmobile.py</code> is the single file that provides everything you need.</p>
<p>If you are running code in a WSGI environment, you will have a handle to the WSGI environment. This is normally called <code>environ</code> by convention, and is passed in to your application via your top-level WSGI callable. To make the PercentMobile tracking code work, you need only make one call to the <code>percentmobile.tracker_cookie_insert</code> function. It returns two values: the cookie that you’ll need to set in the HTTP response headers, and the HTML that you should insert into your page.</p>
<p>Say, for example, you had a very simple WSGI app. This responds to requests with an HTTP 200 status code, a single header and some simple HTML:</p>
<pre><code>def my_app(environ, start_response):
    status = '200 OK'
    response_headers = [('Content-type','text/html')]
    start_response(status, response_headers)
    return ["Hello world"]</code></pre>
<p>To add PercentMobile tracking to this code, you need to firstly import the tracker library of course, and then call the <code>tracker_cookie_insert</code> function:</p>
<pre><code>import percentmobile
cookie, insert = percentmobile.tracker_cookie_insert(environ, '1234555')</code></pre>
<p>(Of course you should replace the final string with your own site ID!)</p>
<p>The <code>cookie</code> return value is actually a dictionary of the different parts needed to construct its string serialization. This will allow you to splice together multiple cookies, or alter the expiry time, path scope and so on. To convert the dictionary to a string, and to get the Set-Cookie header sent back in the request headers, the following code will suffice:</p>
<pre><code>cookie = "%s=%s; expires=%s; path=%s" % (
    cookie['name'],
    cookie['value'],
    cookie['expires'],
    cookie['path']
)
response_headers = [('Content-type','text/html'), ('Set-Cookie', cookie)]</code></pre>
<p>Finally, you need to make sure the HTML fragment, in the <code>insert</code> variable, gets placed in the HTML response:</p>
<pre><code>return ["&lt;html&gt;&lt;body&gt;Hello world %s&lt;/body&gt;&lt;/html&gt;" % insert]</code></pre>
<p>And that’s a wrap. The whole, PercentMobile-tracked WSGI application looks like this:</p>
<pre><code>def my_app(environ, start_response):
    cookie, insert = percentmobile.tracker_cookie_insert(environ, '1234555')
    cookie = "%s=%s; expires=%s; path=%s" % (
        cookie['name'],
        cookie['value'],
        cookie['expires'],
        cookie['path']
    )
    status = '200 OK'
    response_headers = [('Content-type','text/html'), ('Set-Cookie', cookie)]
    start_response(status, response_headers)
    return ["&lt;html&gt;&lt;body&gt;Hello world %s&lt;/body&gt;&lt;/html&gt;" % insert]</code></pre>
<p>Pretty easy, huh? Well, not as easy as tracking an app if you’re using the amazing Django framework! Contained in the same <code>percentmobile.py</code> file is a class that can be used as Django middleware. It uses the same underlying function as the WSGI implementation, but also takes care of the headers and insertion for you.</p>
<p>Assuming you’ve placed the library file in your Python or Django path, you simply need to add two lines of code in the settings file. Firstly add the <code>percentmobile.PercentMobileDjangoMiddleware</code> class to your list of middleware:</p>
<pre><code>MIDDLEWARE_CLASSES = (
    ...
    'percentmobile.PercentMobileDjangoMiddleware'
)</code></pre>
<p>And secondly, add your PercentMobile site ID to the settings file too:</p>
<pre><code>PERCENTMOBILE_SITE_ID = '1234555'</code></pre>
<p>Um… that’s it. The middleware will intercept the request, figure out the cookie that will need to be sent in the response, create the insertion code, and place it just before <code>&lt;/body&gt;</code> in the response. You’re golden. I love Django.</p>
<h2>ASP.NET: C# &amp; VB.NET</h2>
<p>Switching over to another world altogether, let’s take a quick look at the <a href="http://asp.net/" target="_blank">ASP.NET</a> implementation of the tracking code. One of the great things about .NET is that you can choose between all sorts of different languages to write your applications and pages in. I decided to write the tracking library in C#, but you can use it declaratively in your page code, or programmatically from C#, VB.NET, or any other supported language.</p>
<p>The library is implemented as a User Control &#8211; that is, as a .ascx file. You need to download and add <code>PercentMobile.ascx</code> to your web application project.</p>
<p>To embed the tracking logic into a page (or probably preferably, a master page), you simply register the user control as residing in that file:</p>
<pre><code>&lt;%@ Register TagPrefix="pm" TagName="Tracker" Src="~/PercentMobile.ascx" %&gt;</code></pre>
<p>And then embed the control straight into the .aspx file contents, wherever you want it to be:</p>
<pre><code>&lt;pm:Tracker runat="server" SiteId="1234555" /&gt;</code></pre>
<p>So a simple, tracked .aspx file might look something like this:</p>
<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" %&gt;
&lt;%@ Register TagPrefix="pm" TagName="Tracker" Src="~/PercentMobile.ascx" %&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;&lt;title&gt;Hello World&lt;/title&gt;&lt;/head&gt;
    &lt;body&gt;
        &lt;form id="form1" runat="server"&gt;
            &lt;div&gt;Hello World&lt;/div&gt;
            &lt;pm:Tracker runat="server" SiteId="1234555" /&gt;
        &lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>To be honest, this is so simple that I would expect most people to use the control declaratively. But if, for some reason, the control needs to be inserted programmatically, that’s pretty easy too. You need to use the <code>Reference</code> directive, instead of <code>Register</code>, at the top of the file, but otherwise it’s not much harder. Here, we’re using VB.NET to programmatically achieve exactly the same result as above:</p>
<pre><code>&lt;%@ Page Language="VB" AutoEventWireup="true" %&gt;&lt;%@ Reference Control="~/PercentMobile.ascx" %&gt;

&lt;script runat="server"&gt;
    Private tracker As PercentMobile.Tracker
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        tracker = CType(LoadControl("~/PercentMobile.ascx"), PercentMobile.Tracker)
        tracker.siteId = "1234555"
        form1.Controls.Add(tracker)
    End Sub
&lt;/script&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;&lt;title&gt;Hello World&lt;/title&gt;&lt;/head&gt;
    &lt;body&gt;
        &lt;form id="form1" runat="server"&gt;
            &lt;div&gt;Hello World&lt;/div&gt;
        &lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;

</code></pre>
<p>(It should be fairly straightforward to see how to do this in other .NET languages &#8211; PercentMobile includes some examples in their install instructions.)</p>
<h2>Java</h2>
<p>Onwards. Let’s take a look at the tracking code for <a href="http://java.com" target="_blank">Java</a>. There are numerous ways in which Java can be used for web or application server environments. To keep things simple, I decided that supporting JSP was more or less the most familiar and reusable approach.</p>
<p>JSP doesn’t enjoy the rich page event model that I was able to use in ASP.NET to intercept headers, write cookies, and insert HTML, all with one include. <code>&lt;jsp:include&gt;</code> is OK for adding the HTML snippets, but wouldn’t let me access the HTTP headers. <code>&lt;jsp:forward&gt;</code> does, but would only work if you weren’t planning to emit any HTML of your own after the tracking code &#8211; something of a radical assumption.</p>
<p>So I settled for an approach where an include <em>directive</em> creates an instance of an inner <code>PercentMobile</code> class defined within the JSP class. To cut a long story short, this means you merely add a reference to the library file at the top of the JSP file:</p>
<pre><code>&lt;%@ include file="percentmobile.jsp" %&gt;</code></pre>
<p>And then call the track method on that instance, somewhere within the page:</p>
<pre><code>&lt;%percentMobile.track("1234555");%&gt;</code></pre>
<p>The included JSP file takes care of instantiating the <code>percentMobile</code> object and giving it references to the request and response stream. This means it can read and write cookies, and later emit HTML. Your tracked Hello World in Java then? It’s as simple as this:</p>
<pre><code>&lt;%@ include file="percentmobile.jsp" %&gt;
 &lt;html&gt;
  &lt;body&gt;
    Hello World
    &lt;%percentMobile.track("1234555");%&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
<h2>node.js</h2>
<p>OK, OK. Python, ASP.NET, Java. No big deal, right? That’s all so 2003 or so, right?</p>
<p>Well, there’s an alternative future for web server technologies. It’s one that’s blazingly fast, lightweight, event-driven, and… where you write your server logic in Javascript.</p>
<p><a href="http://nodejs.org/" target="_blank">node.js</a> is one of the most exciting things I’ve seen for a long time, and I know I’m not alone. Fresh, fashionable, and somewhat unproven, admittedly, it’s had a lot of gushing coverage. But since it turns the web server model (almost literally) inside out, I do believe there’s something important going on.</p>
<p>Would it be possible to write a web app with node.js and still have it tracked by PercentMobile? My challenge.</p>
<p>I decided to rely on <a href="http://howtonode.org/connect-it" target="_blank">Connect</a>, a middleware framework for node.js, which, if you are writing web applications, provides a whole host of other helpful web logic. Using Connect to create a simple node.js app is extremely easy:</p>
<pre><code>var Connect = require('connect');
Connect.createServer(
  function (req, res, next) {
    res.simpleBody(200,
      "&lt;html&gt;&lt;body&gt;Hello World" +
      "&lt;/body&gt;&lt;/html&gt;",
      {
        "Content-Type": "text/html"
      }
    );
  }
).listen(88);</code></pre>
<p>To add PercentMobile tracking to this application firstly requires you to pull in the PercentMobile module:</p>
<pre><code>var PercentMobile = require('./percentmobile');</code></pre>
<p>(Where the <code>percentmobile.js</code> file has been placed in your node.js environment or in the common modules location.)</p>
<p>The module needs to be initialized as a piece of Connect middleware in the createServer function:</p>
<pre><code>PercentMobile.init('1234555')</code></pre>
<p>There are then two module functions, <code>cookie</code> and <code>html</code>, which both take a reference to the response object, and which return the cookie string and HTML to insert, respectively. These can be used in Connect’s <code>simpleBody</code> function, for example, meaning that our tracked application is as simple as this:</p>
<pre><code>var Connect = require('connect');
var PercentMobile = require('./percentmobile');
Connect.createServer(
  PercentMobile.init('1234555'),
  function (req, res, next) {
    res.simpleBody(200,
      "&lt;html&gt;&lt;body&gt;Hello World" +
        PercentMobile.html(res) +
      "&lt;/body&gt;&lt;/html&gt;",
      {
        "Content-Type": "text/html",
        "Set-Cookie": PercentMobile.cookie(res)
      }
    );
  }
).listen(88);</code></pre>
<h2>That’s a wrap</h2>
<p>So that’s it. A whistle-stop tour of the new languages and frameworks supported by PercentMobile. I’d love to hear your feedback on how easy (or hard!) these new APIs are to use.</p>
<p>And, oh… who will be the first to build a mobile web app on node.js? <img src='http://tripleodeon.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2010/08/mobile-analytics-with-python-django-asp-net-java-and-node-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WhitherApps</title>
		<link>http://tripleodeon.com/2010/08/whitherapps/</link>
		<comments>http://tripleodeon.com/2010/08/whitherapps/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 03:10:20 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=363</guid>
		<description><![CDATA[Why spend your life recompiling native client apps when you have HTML5 and the mighty mobile web at your disposal? WhitherApps sets out to debunk some contemporary mobile myths. WhitherApps is a bandwagon-busting experiment. I believe there are far too many native client apps which could have been far better written as mobile web apps. [...]]]></description>
			<content:encoded><![CDATA[<p>Why spend your life recompiling native client apps when you have HTML5 and the mighty mobile web at your disposal? <a href="http://whitherapps.com">WhitherApps</a> sets out to debunk some contemporary mobile myths.</p>
<p><span id="more-363"></span></p>
<p>WhitherApps is a bandwagon-busting experiment. I believe there are  far too many native client apps which could have been far better written  as mobile web apps. What I&#8217;m trying to do with the project is take a few particularly obvious examples, apply a little reverse-engineering, and rewrite them, warts  and all, with web technologies.</p>
<p>I&#8217;m focussing on native client apps that are free to download. These  wouldn’t have suffered commercially had they been written this way in  the first place. Obviously, I’ll also focus on feasible genres of apps. No 3D games  or background apps, for example. To start with, informational media apps  (such as newspapers and broadcasters) will be in the spotlight.</p>
<p>But otherwise, I may not need to pull too many punches. Offline  access? Through the wonders of HTML5, that should be OK. Native device  API access? Well, BONDI and proprietary libraries permitting, I’ll have  a go – and there’s always PhoneGap too.</p>
<p>Each post on the site will be a walkthrough (or part of a walkhrough)  of the process. As I get my hands dirty, from the protocol-sniffing  to the pixel-jiggling, you can follow the steps I took.</p>
<p>Stay tuned and wish me luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2010/08/whitherapps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Trends 2020 &#8211; a brief review</title>
		<link>http://tripleodeon.com/2010/01/mobile-trends-2020-a-brief-review/</link>
		<comments>http://tripleodeon.com/2010/01/mobile-trends-2020-a-brief-review/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 22:35:26 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=356</guid>
		<description><![CDATA[A curious affliction of the mobile blogosphere is its propensity for annual predictions about what will happen next in our industry. It&#8217;s a badly-kept secret that this frustrates me. Mostly because: A year really isn&#8217;t a very long time, whatever the cliché tells you… very little surprising happens in 12 months an industry dominated mostly [...]]]></description>
			<content:encoded><![CDATA[<p>A curious affliction of the mobile blogosphere is its propensity for annual predictions about what will happen next in our industry. It&#8217;s a badly-kept secret that this frustrates me. Mostly because:</p>
<ul>
<li>A year really isn&#8217;t a very long time, whatever the cliché tells you… very little surprising happens in 12 months an industry dominated mostly by large companies and continuous market dynamics.</li>
<li> It doesn&#8217;t take a lot of research into any topic to be able to make a handful of sensible predictions about it. (Flat rate tariffs more common? Really? I should think Antarctic will thaw quicker than last year too, and there will be progress in HIV research.)</li>
<li> They&#8217;re rarely actionable. I&#8217;m unlikely to buy shares on such vague tips, and I can&#8217;t wager against their accuracy at my local bookmakers. Do these lists exist to bolster the reader&#8217;s wealth or knowledge? Or perhaps demonstrate how perceptive the writers think they are?</li>
<li> Wouldn&#8217;t it be better to spend the same effort actually helping to make the future come true in the first place? <img src='http://tripleodeon.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>But this week saw the publication of a collection of 40 or so pundits&#8217; predictions <a href="http://www.m-trends.org/2010/01/mobile-trends-2020.html">mobile trends for the coming decade</a>. Should I dislike this 400 times more? Well, fortunately no! Ten years gives more room for the predictions to breathe, and the collective nature of the project should mean broader trends can be spotted.</p>
<p>The document is curated by Rudy De Waele, for whom I have lot of respect. He&#8217;s got the enthusiasm and boundless energy that fits well with the promise of mobile. It must have taken a fair bit of effort to pull this project together: a set of slides containing the predictions from a large number of contributors. The document has already been very successful and well circulated. And there are some very clever people involved.</p>
<p>In choosing the contributors, Rudy describes them as his personal &#8216;mobile heroes&#8217;. Fair enough &#8211; but how has that affected the overall roundedness of the project? This, to me, is potentially a worry.</p>
<p>For example, it might have been interesting to have heard from at least one handset manufacturer. This will be a decade of bitter rivalry in that market between the old telecoms guard and already-successful new entrants. Exciting times: and I would love to know what the contenders foresee? And only 3 network operators? However conservative their ambitions, the networks&#8217; plans and predictions are quite likely to shape mobile&#8217;s decade somehow.</p>
<p>Facebook is a good scalp &#8211; although not as revealing as I&#8217;d hoped &#8211; and so are the financier contributions. Most of the remainder of the contributions are from small startups, bloggers, authors, entrepreneurs, &#8216;strategic thinkers&#8217; and &#8216;keynote speakers&#8217;.</p>
<p>Now, I have nothing against such individuals (since I know many of them, they&#8217;re very smart, and that&#8217;s how I&#8217;d probably describe myself too!). But having so many casts a slight pallor over the project: the patina of the developed world&#8217;s well-trodden mobile conference circuit. Punditry that&#8217;s been trotted out for years: affluent, Western, urban- and professional-centric reflections of how we&#8217;d like the industry to fulfill our own personal use-cases.</p>
<p>This is a shame. I wanted this document to surprise me more. The entire world &#8211; economically, politically, climatically &#8211; will change a lot in ten years. I would expect the mobile medium will flex to adapt to those seminal changes far more interestingly than it does to some tactical contemporary challenges.</p>
<p>In the same vein, a missed opportunity may have been to look further abroad. True, there are valid mentions of mobile&#8217;s cultural impact in Africa, but try keyword-searching the document for &#8216;China&#8217;, &#8216;India&#8217;, &#8216;Brazil&#8217;, &#8216;Russia&#8217; (or even &#8216;Japan&#8217;!) and you&#8217;ll be out of luck. Who thinks nothing of interest will happen in those places in the next decade? (Now that <em>would be</em> a surprise).</p>
<p>This all made the predictions, a little, erm, predictable. Yes, yes, I think we all know battery technology will improve, but who was brave enough to make predictions like this?:</p>
<ul>
<li>most mobile web sites in 2020 will be in Chinese</li>
<li> at least one major European operator will have been bought by an Indian conglomerate</li>
<li> the Rio De Janeiro Olympics&#8217; web site will have more mobile visitors than non-mobile</li>
<li> Google&#8217;s home page will default to being mobile in all countries except the US</li>
<li> roaming agreements will be used as collateral in carbon trading markets as the mobile-wielding populations of low-lying countries are resettled</li>
</ul>
<p>Crazy? Sure. But these are just off the bat. I think the aims of such a project should be to inspire, question and provoke. Don&#8217;t give me some short-term platitudes about app stores and widgets. At least not when history is on the move like it will be in this decade.</p>
<p>OK, so perhaps I&#8217;m protesting too much. Despite these flaws, there are some real gems to be found in this document. &#8220;Digital syllogomania&#8221; is a brilliant piece of insight. A few touch on the very likely &#8220;always-on backlash&#8221;, and the promise of mobile-device-as-sensor is tantalizing. I also applaud those predictions that wonder whether mobile technology can change basic human behavior. I&#8217;m doubtful, but it&#8217;s a good question. As <a href="http://tomhume.org/">Tom Hume</a> asks: &#8220;What happens to conversation when it&#8217;s all recorded, or any fact is a 5-second voice-search away from being checked?&#8221;</p>
<p>Anyway, it&#8217;s a few days old now, but do go <a href="http://www.m-trends.org/2010/01/mobile-trends-2020.html">read the document here</a>. And more importantly, make up some of your own. Even more importantly, go and try make them happen. &#8220;It&#8217;s good to talk&#8221;, but the mobile world in the next decade probably belongs to those who make. And those who make the predictions come true.</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2010/01/mobile-trends-2020-a-brief-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The WordPress Mobile Pack is back! And here&#8217;s how.</title>
		<link>http://tripleodeon.com/2009/12/the-wordpress-mobile-pack-is-back-and-heres-how/</link>
		<comments>http://tripleodeon.com/2009/12/the-wordpress-mobile-pack-is-back-and-heres-how/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 19:13:09 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=348</guid>
		<description><![CDATA[Just a quick post to confirm that the WordPress Mobile Pack plugin is back online at wordpress.org. Most WordPress plugins, if &#8216;GPL-compatible&#8217;, are hosted on wordpress.org &#8211; it provides an easy way for people to view and upgrade them. The increasingly popular Mobile Pack is no exception, and we&#8217;ve been happily listed there for over [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to confirm that the <a href="http://wordpress.org/extend/plugins/wordpress-mobile-pack/">WordPress Mobile Pack</a> plugin is back online at wordpress.org.</p>
<p>Most WordPress plugins, if &#8216;GPL-compatible&#8217;, are hosted on wordpress.org &#8211; it provides an easy way for people to view and upgrade them. The increasingly popular Mobile Pack is no exception, and we&#8217;ve been happily listed there for over 6 months.</p>
<p><strong>But what do you do when it suddenly disappears?</strong> About 3 days ago, that&#8217;s exactly what happened. I&#8217;m the administrator of the plugin and could see it when I logged in. But suddenly none of my collaborators &#8211; nor the general public! &#8211; could see or download the plugin.</p>
<p>Our sole channel for software distribution had mysteriously dropped into a black hole &#8211; without a word of notification from WordPress themselves.</p>
<ul>
<li>Assuming it could only therefore be a bug with the wordpress.org web site, I filed a number of support tickets. No response.</li>
<li>Assuming it could only therefore be a permissions or licence issue, I raised a number of forum threads on the site (as, kindly, did Dennis Bournique, over at <a href="http://wapreview.com/">WAP Review</a>). No response.</li>
<li>Assuming I was somehow falling between the cracks, I even emailed <a href="http://ma.tt">Matt Mullenweg</a>. <span style="text-decoration: line-through;">Less surprisingly, no response</span>. UPDATE: I received an apology shortly after this post.</li>
</ul>
<p><strong>Hmm. All rather unsatisfactory.</strong></p>
<p>Well, this morning, a breakthrough. My WPMP partner in crime, <a href="http://blog.trasatti.it/">Andrea Trasatti</a> thought of joining the <a href="https://irclogs.wordpress.org/chanlog.php?channel=wordpress&amp;day=2009-12-18&amp;sort=asc#m336865">WordPress IRC channel</a>. (Obviously he&#8217;s a bit more old school than me). But finally found someone who would be prepared to answer the puzzle.</p>
<p>At this point, I need to point out there there are (true!) other mobile plugins out there. One particularly popular one has been <a href="http://www.andymoore.info/">Andy Moore</a>&#8216;s. He hadn&#8217;t hosted his on wordpress.org due, I guess, to his choice of license, and his &#8211; disclosed &#8211; use of automatic ads in the resulting pages, which WordPress does not permit.</p>
<p>For whatever reason, Andy recently closed down his plugin&#8217;s page, and had kindly redirected it to ours. This probably accounts for our <a href="http://wordpress.org/extend/plugins/wordpress-mobile-pack/stats/">nice increase in traffic</a> in mid-November. Thanks Andy!</p>
<p>However, one of Andy&#8217;s previous plugin downloaders apparently complained about an <a href="http://romanticrobot.net/moreimages/Picture19.png">error message</a> they had received. The WordPress administrators investigated by visiting Andy&#8217;s site, and of course got redirected to our Mobile Pack page. Thinking our plugin was at fault, they then disabled <em>our</em> plugin for violating the no-ads rule.</p>
<p><strong>Oh, and no-one thought to drop me an email to tell me.</strong></p>
<p>But Andrea&#8217;s investigations and protestations prompted us to get re-approved, and we&#8217;re back!</p>
<p>(In the process of investigating this, it also turns out that when WordPress says &#8216;GPL-compatible&#8217; and points you to a list of licenses, that doesn&#8217;t mean much at all. You also have to work out that they actually mean &#8216;GPL2-compatible&#8217;, and not &#8216;GPL3-compatible&#8217;, as our more permissive Apache license is. So I guess we&#8217;ll have to change our license too &#8211; which is a shame.)</p>
<p><strong>I don&#8217;t think WordPress covered themselves with glory here.</strong> In the interests of constructive criticism, I would suggest the company should:</p>
<ul>
<li>Inform a plugin owner whenever there is a complaint raised against it. I would have been able to point out the complaint was aimed at a different piece of software.</li>
<li>Inform a plugin owner when &#8211; or better, before &#8211; disabling a plugin from the listing. I could have had a grace period to have investigated any issues, rather than hear it first as complaints from users.</li>
<li>Respond to &#8216;site bug&#8217; tickets raised on the site.</li>
<li>Make the licensing requirements for plugins more clear. The phrase &#8216;GPL-compatible&#8217; <a href="http://wordpress.org/extend/plugins/about/">here</a>, (and its link), is certainly not precise enough.</li>
<li>Remember that plugin authors work hard to support your business of running the most popular blog platform in the world. Those individuals&#8217; reputations, to a fair extent, rest on your responsible syndication of that code, and they get the grief when you pull the plug.</li>
</ul>
<p>Anyway, thanks guys (and <a href="http://romanticrobot.net/">Mark</a> in particular) for putting it back. And special thanks to Andrea, who now overtakes me in the chocolate-for-favours race.</p>
<p><strong>Now&#8230; back to the roadmap of Mobile Pack coolness. Stay tuned.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/12/the-wordpress-mobile-pack-is-back-and-heres-how/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress Mobile Pack v1.1</title>
		<link>http://tripleodeon.com/2009/07/wordpress-mobile-pack-v11/</link>
		<comments>http://tripleodeon.com/2009/07/wordpress-mobile-pack-v11/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 10:14:09 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[dotMobi]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=322</guid>
		<description><![CDATA[The dotMobi WordPress Mobile Pack is a complete toolkit to help mobilize your WordPress site and blog. We just launched v1.1, compatible with the latest version of WordPress. Download it, read the changelog, read about the features in full, or even join the team. The plugin includes a mobile switcher to select themes based on [...]]]></description>
			<content:encoded><![CDATA[<p>The dotMobi WordPress Mobile Pack is a complete toolkit to help mobilize your WordPress site and blog.</p>
<p>We just launched v1.1, compatible with the latest version of WordPress. <a href="http://wordpress.org/extend/plugins/wordpress-mobile-pack/">Download it</a>, read <a href="http://www.assembla.com/spaces/wordpress-mobile-pack/milestones/95962">the changelog</a>, read about the <a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack">features in full</a>, or even join <a href="http://www.assembla.com/spaces/wordpress-mobile-pack/team">the team</a>.<br />
<span id="more-322"></span></p>
<p>The plugin includes a mobile switcher to select themes based on the type of user that is visiting the site, a selection of mobile themes, extra widgets, device adaptation and a mobile administration panel to allow users to edit the site or write new posts when out and about.</p>
<p>Features include:</p>
<ul>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.1">Mobile switcher</a> to detect mobile visitors and provide an appropriate experience</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.2">Base mobile theme</a> for quick-and-easy XHTML-MP compliance</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.3">Extended mobile themes</a> so you can unleash your mobile creativity</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.4">Transcoding and device adaptation</a> to optimise the mobile experience</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.5">DeviceAtlas integration</a> for world-class adaptation</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.6">Mobile admin panel</a> for when posts can&#8217;t wait</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.7">Mobile ad widget</a> to make you some money</li>
<li><a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack#p2.8">Barcode widget</a> to help users bookmark your blog</li>
</ul>
<p>I have a lot of fun writing this plugin and there&#8217;s a bunch of cool ideas we have for the future. Check out the <a href="http://www.assembla.com/spaces/wordpress-mobile-pack">Assembla project</a> to see the work as it happens &#8211; and maybe toss us some new ideas too.</p>
<p>It&#8217;s always a work in progress, but thousands of users seem happy enough so far. See what you think&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/07/wordpress-mobile-pack-v11/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Simple &#8216;on-server&#8217; mobile AJAX in Django</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/</link>
		<comments>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 11:30:52 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=318</guid>
		<description><![CDATA[Or "How your mobile site may not be much more complicated than building one with a data API or AJAX"]]></description>
			<content:encoded><![CDATA[<p>&#8211;or&#8211;</p>
<p>&#8220;How your mobile site may not be much more complicated than building one with a data API or AJAX&#8221;</p>
<p>I am working on a project called &#8216;IvyRoot&#8217; that is predominantly mobile and which is going to make me fabulously rich and famous.</p>
<p>OK, OK. It&#8217;s predominantly mobile, at least. It&#8217;s all in Django.</p>
<p>There&#8217;s a &#8216;desktop&#8217; web site to go with it, and this contains panels within pages. Some of these panels might take a few moments to process and so I use XHR to call back to get them once the main page has loaded, displaying a pretty spinning icon in the meantime.</p>
<p>I also use XHR to populate in-page tables which might have many rows &#8211; so that pagination and sorting are fast without having to load the whole page again.</p>
<p>I also want to expose a number of data APIs (providing XML, JSON, basic HTML and the like) so that people can build 3rd party clients, their own consuming sites, and widgets.</p>
<p>Finally, I want to provide a mobile web version of the site. I&#8217;ll probably do some sort of device detection to refine the behaviour, but I should assume that plenty of browsers will not be able to do the XHR bit, and should have the page (containing all the panels) in one go &#8211; admittedly after a slightly longer wait.</p>
<p>Well, it occurs to me that these requirements can all be solved at the same time. Switching templates based on URL (or other HttpRequest clues) is pretty easy, so one thing I could do is have a filename extension convention for all my URLs. Imagine a &#8216;things&#8217; view that lists things.</p>
<ul>
<li> <strong>http://ivyroot.com/things</strong> &#8211; this is the human-consumable page: the view surrounded by menus, logos, graphics and the like. Knows how to switch outer template, <a href="http://mobiforge.com/designing/story/a-very-modern-mobile-switching-algorithm-part-i">based on various things</a>, between desktop and mobile.</li>
<li> <strong>http://ivyroot.com/things.html</strong> &#8211; this is the table at the heart of the page, perhaps using unstyled markup containing the list of things itself.</li>
<li> <strong>http://ivyroot.com/things.xml</strong>, <strong>http://ivyroot.com/things.json</strong> etc &#8211; data APIs that list things in various serializations.</li>
</ul>
<p>So perhaps we can set up URL routes like this:</p>
<pre>...
(r'^things$', things),
(r'^things.(?P&lt;mode&gt;[a-z0-9]+)$', things),
...</pre>
<p>And have a view that looks something like this:</p>
<pre>def things(request, mode=''):
    if not mode:
        mode = desktop_or_mobile()
    template = "things.%s" % mode
    ...</pre>
<p>(Or, I suppose we could pass the mode into the template via the context and have some sort of a switch statement in the template itself. It might be good to pass it in, anyway, in case there is any further refinement required within each template.)</p>
<p>Anyway, let&#8217;s also assume that the things list is very long and takes a while to generate. For the desktop users, we might want to either load the table as HTML asynchronously using XHR, or paged into a jQuery grid control. For these two approaches, I can call back to /things.html or /things.json respectively (and do a little extra plumbing to make sure the JSON is in the right format for the grid control to consume).</p>
<p>But what of mobile? Well, for many devices, I can&#8217;t expect any XHR activity to be supported, so we need to insert the table HTML into the body of the things.mobile page before it departs for the client &#8211; and we may need to pre-page it too (if it&#8217;s long). But the good news is that, if I made it simple enough, the HTML generated by things.html might be good enough for either type of browser.</p>
<p>(And if not, I could easily do a little adaptation on <em>that</em> view too &#8211; perhaps turn my table into a list.)</p>
<p>So what I would like to have a is a way of embedding the output of one view (or even URL) into another, whilst the response is still being put together on the server. Try as I could, there didn&#8217;t seem to be anything in Django to do this.</p>
<p>Enter my first <a href="http://www.djangosnippets.org/snippets/1568/">DjangoSnippet</a>!</p>
<p>This basically allows me to put a template tag into the mobile template that pulls the output from one of the other views (identified by view name, with arguments; or a verbatim URL which would be the same as the one used in the desktop&#8217;s XHR request &#8211; nifty!)</p>
<p>It also makes sure that the context for <em>that</em> view is sandboxed with what <em>it</em> needs to render itself &#8211; so that I don&#8217;t have to worry about getting the context ready in the &#8216;outer&#8217; view. That&#8217;s not necessary in our simple example above &#8211; but it might be useful later on if I am dynamically choosing which panels to place on a page, and I want them to gather together their own context prior to template rendering.</p>
<p>Now, I&#8217;ll need to be careful to make sure that any interaction elements within the table &#8211; say, some actions available on each item in the list, or a paginator &#8211; behave suitably for their location. But this may be as simple as toggling between further XHR requests (for desktop) and simple anchor links (for mobile). Forms-in-panels will be harder but similar.</p>
<p>So&#8230; there we are, a glimpse at the inner workings of a mystery application that&#8217;s many weeks away from seeing the light of day.</p>
<p>But hopefully I&#8217;ve raised a few thoughts about how you can treat the mobile version of your site as being a cousin of the data APIs that you might have written anyway. And also how you might be able to sneakily bring some of the funky XHR &#8211; that you wanted to impress your friends with on the desktop &#8211; up into the server to keep your mobile pals happy too.</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Maps &amp; mobile</title>
		<link>http://tripleodeon.com/2009/04/maps-mobile/</link>
		<comments>http://tripleodeon.com/2009/04/maps-mobile/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 17:29:44 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=306</guid>
		<description><![CDATA[I&#8217;m somehow dissatisfied with mobile cartography. On the Hollywood Walk of Fame site, we&#8217;re currently using Google Maps. When I first saw Google Maps on the web, I was thrilled with the cartography. The craft of good map-making started to shine through after a decade of turgid MapQuest vectors. (In a previous life, I lived [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m somehow dissatisfied with mobile cartography.</p>
<p>On the <a href="http://hwof.com">Hollywood Walk of Fame</a> site, we&#8217;re currently using Google Maps. When I first saw Google Maps on the web, I was thrilled with the cartography. The craft of good map-making started to shine through after a decade of turgid <a href="http://www.mapquest.com/">MapQuest</a> vectors.</p>
<p>(In a previous life, <a href="http://www.google.com/search?q=james+pearce+world+orienteering">I lived for maps</a>&#8230; so I take this very seriously!)</p>
<p>And on HWOF, sure, it does what it should. The now-familiar style has a comforting effect for users I suppose.</p>
<p>But, both with and without the &#8216;mobile&#8217; option set in the API (shown on the right &#8211; worse I think!), and <em>despite</em> the huge watermark on the limited real-estate, I&#8217;m personally tiring of it.</p>
<p><img class="alignnone size-medium wp-image-307" src="http://tripleodeon.com/files/2009/04/desk.gif" alt="" width="228" height="228" /> vs <img class="alignnone size-medium wp-image-308" src="http://tripleodeon.com/files/2009/04/mobile.gif" alt="" width="228" height="228" /></p>
<p>Maybe it&#8217;s the burnish of familiarity. I&#8217;ve seen this style so much that it holds no allure or beauty any more. Maybe because it appeals more to drivers than pedestrians. Maybe because of the uninspiring Arial font. Or maybe just because I&#8217;d like to be more in control? All of the above.</p>
<p>Anyway, I&#8217;ve started to look at alternatives. On one hand we&#8217;re looking at some commercial possibilities with other map (and location data) providers.</p>
<p>But on the hand, I&#8217;ve been sucked into the thought of using <a href="http://cloudmade.com/">CloudMade</a>. Built on top of the excellent <a href="http://www.openstreetmap.org/">OpenStreetMap</a> project, it allows everyone to become a cartographer &#8211; or at least, to apply new themes and styles to the map structures from OSM.</p>
<p>A great example? Check out <a href='http://magicalnihilism.wordpress.com/2009/04/06/my-first-cloudmade-map-style-lynchian_mid'>Matt Jones&#8217;</a> lovely map:</p>
<p><img src='http://farm4.static.flickr.com/3629/3418578216_abb4b09b7b.jpg' border='0' width='500' height='317' /></p>
<p>Which, interestingly, immediately made me think of John Speed:</p>
<p><img src='http://i.tinysrc.mobi/500/327/http://faculty.oxy.edu/horowitz/home/johnspeed/js_images/london.jpg' width='500' height='327' /></p>
<p>Nothing new in the world, eh?</p>
<p>Anyway&#8230; this is now interesting. I&#8217;m no graphic designer, but I&#8217;ve done my fair share of <a href="http://www.chig.org.uk/Club_Mapped.htm">map-making</a>. I do know how to make important features rise to the foreground. And make irrelevant aspects fade to the back. Serve specific purpose. A map is not just a dry record of geographic fact: it should be created entirely with the context of the user in mind.</p>
<p>Hey! Just like mobile web applications.</p>
<p>So I am on a crusade to in find the perfect mobile map. A cartographic style that jumps out of a handheld screen. A visual vocabulary that caress a mobile user&#8217;s spatial awareness. Maps that blend seamlessly into the device&#8217;s user interface, rather than merely rectangular crashups. A panache that brings vectors to life. That crosses the boundary into art.</p>
<p>And that can do so, effortlessly, in 176 pixels or less.</p>
<p>The world is full of brilliant maps of many kinds. But do any of them cut it in the mobile medium? Is that medium so different that we have to start again with some of our cartographic assumptions? Will I ever be satisfied?</p>
<p>Well, I don&#8217;t know yet. But I do know that I&#8217;m going to have a lot of fun fiddling with CloudMade.</p>
<p>What&#8217;s your favourite mobile map, cartographic style or service? And why?</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/04/maps-mobile/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New blog design &amp; apologies</title>
		<link>http://tripleodeon.com/2009/03/new-blog-design-and-apologies/</link>
		<comments>http://tripleodeon.com/2009/03/new-blog-design-and-apologies/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 23:05:02 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=289</guid>
		<description><![CDATA[Welcome to my new blog theme. It includes a pseudo-portfolio for my various mobile activities in 2009. I had to generate some new resumé-style posts and they probably all showed up in your feeds. Sorry. If you&#8217;re on the new site, I hope you like it. If you&#8217;re reading this on RSS, maybe it appeared [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to my new blog theme. It includes a pseudo-portfolio for my various mobile activities in 2009.</p>
<p>I had to generate some new resumé-style posts and they probably all showed up in your feeds. Sorry.</p>
<p>If you&#8217;re on the new site, I hope you like it.<br />
<span id="more-289"></span><br />
If you&#8217;re reading this on RSS, maybe it appeared above.</p>
<p>Well, now we&#8217;re back on track.</p>
<p>The site now serves as much as a business card as it does a blog&#8230; but I will try to put the occasional post up to remind you that I&#8217;m still alive. Well, outside of <a href="http://twitter.com/jamespearce">Twitter</a> and <a href="http://jajajeev.com">JaJaJeEv</a> anyway.</p>
<p>By the way, I&#8217;m quite please with the favicon.</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/03/new-blog-design-and-apologies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Google AdSense for Mobile code</title>
		<link>http://tripleodeon.com/2009/03/python-google-adsense-for-mobile-code/</link>
		<comments>http://tripleodeon.com/2009/03/python-google-adsense-for-mobile-code/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 20:27:21 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=162</guid>
		<description><![CDATA[I was amazed to discover that Google don&#8217;t currently support Python as a language for their mobile ads. AdMob doesn&#8217;t either (thinking it&#8217;s more likely that people might use perl or VBScript for a contemporary web site). But it&#8217;s a particularly strange omission for Google, since it&#8217;s one of their three &#8216;official&#8217; internal languages (together [...]]]></description>
			<content:encoded><![CDATA[<p>I was amazed to discover that Google don&#8217;t currently support Python as a language for their mobile ads. AdMob doesn&#8217;t either (thinking it&#8217;s more likely that people might use perl or VBScript for a contemporary web site).</p>
<p>But it&#8217;s a particularly strange omission for Google, since it&#8217;s one of their three &#8216;official&#8217; internal languages (together with Java and C++), and because their Google App Engine platform mandates it. Do they assume that no-one would create a mobile application in their cloud?</p>
<p>I don&#8217;t know &#8211; it&#8217;s probably just left-hand and right-hand out of sync.</p>
<p>Anyway, <a href="http://hwof.com" target="_blank">The Hollywood Walk of Fame</a> <a href="http://hwof.mobi" target="_blank">mobile site</a> has been a recent hobby for me, and I chose Django on Python for a bit of educational fun.</p>
<p>It was going well until I decided to throw some ads onto it.</p>
<p>So of course I needed to port the ad code. It&#8217;s very simple, although cuts a few corners (this does not support AdSense&#8217;s custom colour feature for example):</p>
<pre>
def google_ad(request, publisher_id, format='mobile_single'):
  scheme = 'https://' if request.is_secure() else 'http://'
  params = {
    'ad_type':'text_image',
    'channel':'',
    'client':'ca-mb-' + publisher_id,
    'dt':repr(floor(1000*time())),
    'format':format,
    'https':'on' if request.is_secure() else '',
    'host':scheme + request.META.get('HTTP_HOST', ''),
    'ip':request.META.get('REMOTE_ADDR', ''),
    'markup':'xhtml',
    'oe':'utf8',
    'output':'xhtml',
    'ref':request.META.get('HTTP_REFERER', ''),
    'url':scheme + request.META.get('HTTP_HOST', '') + \
          request.META.get('PATH_INFO', ''),
    'useragent':request.META.get('HTTP_USER_AGENT', '')
  }
  screen_res = request.META.get('HTTP_UA_PIXELS', '')
  delimiter = 'x'
  if screen_res == '':
    screen_res = request.META.get('HTTP_X_UP_DEVCAP_SCREENPIXELS', '')
    delimiter = ','
  res_array = screen_res.split(delimiter)
  if len(res_array) == 2:
    params['u_w'] = res_array[0]
    params['u_h'] = res_array[1]
  dcmguid = request.META.get('HTTP_X_DCMGUID', '')
  if dcmguid != '':
    params['dcmguid'] = dcmguid
  url = 'http://pagead2.googlesyndication.com/pagead/ads?' + urlencode(params)
  return urlopen(url).read()
</pre>
<p>&nbsp;</p>
<p>I presume I&#8217;m allowed to do this, I know it&#8217;s only 15 minutes saved &#8211; but if it helps someone, great. No warranties &#8211; but it works for me!</p>
<p>Incidentally, in Django, I am placing this in a context_processor so that it gets put into a template variable that I know will turn up in every view when the site is in mobile &#8216;mode&#8217;. I use a switcher like <a href="http://mobiforge.com/designing/story/a-very-modern-mobile-switching-algorithm-part-i" target="_blank">this</a> to toggle between <a href="http://hwof.com" target="_blank">http://hwof.com</a> and <a href="http://hwof.mobi" target="_blank">http://hwof.mobi</a>.</p>
<p>Hm. This post looks terrible in this theme. I think I need to change WordPress template soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/03/python-google-adsense-for-mobile-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A mail I couldn&#8217;t send</title>
		<link>http://tripleodeon.com/2009/02/a-mail-i-couldnt-send/</link>
		<comments>http://tripleodeon.com/2009/02/a-mail-i-couldnt-send/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 16:43:30 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Mobile Web]]></category>

		<guid isPermaLink="false">http://tripleodeon.com/?p=159</guid>
		<description><![CDATA[After someone I respect got banned from the WMLProgramming mailing list, I wrote to agree with one or two other members who were disappointed with the state of affairs. I&#8217;ve been a member since, I guess, the first few weeks of the group&#8217;s existence &#8211; even if I haven&#8217;t been a day-to-day contributor. Sadly it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://www.tomhume.org/2009/02/banned-from-wmlprogramming.html" target="_blank">someone I respect</a> got banned from the WMLProgramming mailing list, I wrote to agree with one or two other members who were disappointed with the state of affairs.</p>
<p>I&#8217;ve been a member since, I guess, the first few weeks of the group&#8217;s existence &#8211; even if I haven&#8217;t been a day-to-day contributor. Sadly it&#8217;s gone downhill over the last year or so.</p>
<p>Why? It&#8217;s a long story. The mobile developer community has a desire to have a strong position on unprovoked content transformation. This is a good thing.</p>
<p>But the approach taken to get their message across involves some of the most inflammatory, derogatory, and unprofessional behaviour I&#8217;ve ever seen online. This is not a good thing.</p>
<p>I was disappointed that the reputation of the group was sinking so low. It also occured to me that, as a member, this behaviour was implicitly in my name.</p>
<p>But not for long! I was promptly banned from the group.  Well, I suppose I was leaving anyway, so maybe it was no big deal.</p>
<p>But shortly after, a rather rude mail was written in response, making some outlandish claims about some corporate conspiracy I&#8217;m supposed to be part of. But could I respond? No! I&#8217;d been banned. I guess to make sure you get the last word, the best way is to limit the other party&#8217;s ability to respond.</p>
<p>So anyway, I don&#8217;t really want to labour the point. But here&#8217;s what I wrote as my last post to the group and couldn&#8217;t send &#8211; thanks to the membership button being grayed out.</p>
<p>After all that fruitless typing, and in the interests of free speech, I just feel it needs to see the light of day somehow <img src='http://tripleodeon.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Luca,</p>
<p>You do indeed deserve huge thanks for the many years of hard work and success. The manifesto and it could have been a memorable agent for good on behalf of the industry as a whole. It may still become so.</p>
<p>I fully admire your goals, but with them comes an attitude that ruins the external reputation of the group &#8211; and the chances of those goals ever being met. Further, the reputation of the group is projected onto its members.</p>
<p>That is why I&#8217;m leaving. This brand of militarism does not represent my broader interests in the growth of the mobile web.</p>
<p>Let me also state clearly that my opinions about the situation have absolutely nothing to do with my recent employer or its investors: I&#8217;m sorry to disappoint you, but there really is no conspiracy.</p>
<p>I hope that one day this famous list will return to being positive and friendly again.</p>
<p>(Doubtless you&#8217;ve more positive and friendly things to say on the matter too. But since you banned me, do note I won&#8217;t be receiving further replies.)</p>
<p>James</p>
]]></content:encoded>
			<wfw:commentRss>http://tripleodeon.com/2009/02/a-mail-i-couldnt-send/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
