<?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>The world (and word) of jaymz</title>
	<atom:link href="http://jaymz.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://jaymz.eu</link>
	<description></description>
	<lastBuildDate>Wed, 11 Aug 2010 11:28:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Integrating ooyala in django (or just python)</title>
		<link>http://jaymz.eu/2010/07/integrating-ooyala-in-django-or-just-python/</link>
		<comments>http://jaymz.eu/2010/07/integrating-ooyala-in-django-or-just-python/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 11:34:26 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[ooyala]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=495</guid>
		<description><![CDATA[Ooyala is a feature rich video hosting platform. Something I needed recently was some way to link the data over at ooyala into a django site I&#8217;m building. So I wrote myself a library. It&#8217;s available over at github and it&#8217;s called (predictably) django-ooyala. Currently there is a management command syncooyala to pull in all [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jaymz.eu/wp-content/uploads/2010/07/django-ooyala-logo.png"><img class="aligncenter size-full wp-image-497" title="django-ooyala-logo" src="http://jaymz.eu/wp-content/uploads/2010/07/django-ooyala-logo.png" alt="" width="350" height="133" /></a></p>
<p>Ooyala is a feature rich video hosting platform. Something I needed recently was some way to link the data over at ooyala into a django site I&#8217;m building. So I wrote myself a library. It&#8217;s available over at github and it&#8217;s called (predictably) <em><a href="http://github.com/jaymzcd/django-ooyala">django-ooyala</a>.</em> Currently there is a management command <strong>syncooyala</strong> to pull in all the data using the Backlot Query API. These imported items are then linked to a specific URL. Finally in your templates there is a <em>ooyala_video</em> tag which when given the current path (via request.path) returns the &lt;script&gt; tags needed for it to render.</p>
<p>Expect some updates as I flesh it out into the front end over the next few days.</p>
<p><strong><em>Updated (11th August): <span style="font-weight: normal;">I have added in analytics support. You can now make requests for video stat&#8217;s for a given account or video. The facebook SDK has also been added with a new template tag to output the headers in your template for a given video. Remember to request whitelisting from facebook for SWF embeds to work.</span></em></strong></p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jaymz.eu/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="python"><span class="kw1">from</span> django.<span class="me1">http</span> <span class="kw1">import</span> HttpResponse
<span class="kw1">from</span> ooyala.<span class="me1">library</span> <span class="kw1">import</span> OoyalaAnalytics
<span class="kw1">from</span> ooyala.<span class="me1">constants</span> <span class="kw1">import</span> OoyalaConstants as O
<span class="kw1">from</span> ooyala.<span class="me1">models</span> <span class="kw1">import</span> OoyalaItem
&nbsp;
<span class="kw1">def</span> backlot_query<span class="br0">&#40;</span>request<span class="br0">&#41;</span>:
    req = OoyalaAnalytics<span class="br0">&#40;</span>video=OoyalaItem.<span class="me1">objects</span>.<span class="me1">all</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>.<span class="me1">embed_code</span>, \
        method=O.<span class="me1">ANALYTIC_METHODS</span>.<span class="me1">VIDEO</span><span class="br0">&#41;</span>
    ooyala_response = req.<span class="me1">process</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
    <span class="kw1">return</span> HttpResponse<span class="br0">&#40;</span>ooyala_response.<span class="me1">toprettyxml</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, mimetype=<span class="st0">&quot;text/xml&quot;</span><span class="br0">&#41;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/07/integrating-ooyala-in-django-or-just-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tube Delay Refund for android released</title>
		<link>http://jaymz.eu/2010/07/tube-delay-refund-for-android-released/</link>
		<comments>http://jaymz.eu/2010/07/tube-delay-refund-for-android-released/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 02:21:46 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=489</guid>
		<description><![CDATA[Update (v1.4.0) National Rail &#38; TFL Travelcard support has been added. (August 2nd) Update (v1.3.2) Some layout rejigging has been done, defaults added and a few more menu options for resetting/prefilling. The preferences layout has also been tidied. (July 17) Updated (v1.2.0) I have updated this app to disable submission until all the station/date info [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (v1.4.0) </strong><em>National Rail &amp; TFL Travelcard support has been added. (August 2nd)</em></p>
<p><strong>Update<em> </em>(v1.3.2) </strong><em>Some layout rejigging has been done, defaults added and a few more menu options for resetting/prefilling. The preferences layout has also been tidied. (July 17)</em></p>
<p><strong>Updated (v1.2.0) </strong><em>I have updated this app to disable submission until all the station/date info is added. I&#8217;ve also added some more labels to show what&#8217;s been entered so far. You <span style="text-decoration: underline;">must</span> make sure you&#8217;ve filled in all the preferences or else it&#8217;ll fail (Click menu&gt;preferences). (July 16)</em></p>
<p>A few days ago I was in bed trying to sleep and I suddenly thought it would be good if there was an app to submit refunds for the tube as you come out. I had in my head the idea of a timer that would count down from 15 minutes and then alert you that you were in valid refund territory.</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/07/131.png"><img class="aligncenter size-full wp-image-508" title="131" src="http://jaymz.eu/wp-content/uploads/2010/07/131.png" alt="" width="576" height="432" /></a></p>
<p>After I coded said timer, I pushed it live without refund submissions working. I also did a quick google to see what else there was only to discover that there was a company that released the exact same app on the iPhone about 3 months ago. Let this be a lesson that if you are about to code something as an exercise <em>don&#8217;t</em> go googling first or you&#8217;ll inevitably be put off because &#8220;whats the point&#8221;.</p>
<p style="text-align: center;">
<p>Several hours later today and it is now submitting refund applications to TFL and I get an email confirmation with the reference number. I&#8217;m very happy if incredibly tired. The app is free for now, all the others that do these on Blackberry/iOS are paid for. There doesn&#8217;t seem to be one for android yet, the guys that did the iPhone app said they where working on one way back in March or April, not quite sure what happened to it. They&#8217;re about to release the blackberry one so for now this is the <em>only</em> refund submission app on android <img src='http://jaymz.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Took me basically 2 days part time.</p>
<p><a href="http://www.androidzoom.com/android_applications/travel/tube-refund_ipjg.html"><img class="aligncenter size-full wp-image-491" title="promo" src="http://jaymz.eu/wp-content/uploads/2010/07/promo.png" alt="" width="180" height="120" /></a></p>
<p>From a technical point of view this is making use of the apache http libraries to do a GET request for the TFL refund page. It parses that to grab the ASPX Viewstate variable and session cookies. Then it grabs the data from the main activity and combines that with the data stored in shared preferences for the form variables. The POST request is processed and the response parsed again to find the reference number. That&#8217;s then displayed via a Toast call. Fairly simple, having to deal with the viewstate crap was probably the most annoying part, that and debugging the actual POST.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/07/tube-delay-refund-for-android-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SpineMagazine.com radio player &amp; news reader for android</title>
		<link>http://jaymz.eu/2010/07/spinemagazine-com-radio-player-news-reader-for-android/</link>
		<comments>http://jaymz.eu/2010/07/spinemagazine-com-radio-player-news-reader-for-android/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 00:20:38 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=467</guid>
		<description><![CDATA[Quite a while back I was trying to get my head around the fairly complex ListView control for android and something I thought perfect for it was the set of radio shows over at spine magazine. I have had this code sitting around for a while and I thought why not knock out the news [...]]]></description>
			<content:encoded><![CDATA[<p>Quite a while back I was trying to get my head around the fairly complex <a href="http://developer.android.com/reference/android/widget/ListView.html">ListView</a> control for android and something I thought perfect for it was the set of radio shows over at <a href="http://www.spinemagazine.com">spine magazine</a>.</p>
<table width="100%">
<tbody>
<tr>
<td>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/07/screen-shows.png"><img class="aligncenter size-full wp-image-469" title="screen-shows" src="http://jaymz.eu/wp-content/uploads/2010/07/screen-shows.png" alt="" width="224" height="336" /></a></p>
</td>
<td>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/07/screen-news1.png"><img class="aligncenter size-full wp-image-476" title="screen-news" src="http://jaymz.eu/wp-content/uploads/2010/07/screen-news1.png" alt="" width="224" height="336" /></a></p>
</td>
</tr>
</tbody>
</table>
<p>I have had this code sitting around for a while and I thought why not knock out the news code and release it and then just continue to work on it and update it. As the saying goes, <em>release early, release often!</em> I think it&#8217;ll be easy enough to add in reviews using the same sort of code to get the data and just re-using the show layout. This particular app was a lot more complicated than the django-reference thing, so here is some of what I&#8217;ve learned&#8230; You can get this in the marketplace now. Bug reports are expected &amp; indeed welcome.</p>
<p><a href="http://jaymz.eu/wp-content/uploads/2010/07/logo.png"><img class="aligncenter size-full wp-image-484" title="logo" src="http://jaymz.eu/wp-content/uploads/2010/07/logo.png" alt="" width="100" height="100" /></a></p>
<p><span style="color: #ff0000;"><strong>Warning! Technical crap follows.</strong></span></p>
<p>It takes a bit of time to get your head around it, essentially you subclass the <a href="http://developer.android.com/reference/android/widget/ArrayAdapter.html">ArrayAdapter</a> class with a container class to hold your list view elements. The ArrayAdapter is a templated class so you first need another class that is actually going to hold your data. This is were you&#8217;ll need to create a class for your data and then instantiate the ArrayList with this type. The code to hold my news post data is very simple:</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jaymz.eu/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="java"><span class="kw2">package</span> eu.<span class="me1">jaymz</span>.<span class="me1">spinemag</span>;
&nbsp;
<span class="co2">import android.util.Log;</span>
&nbsp;
<span class="kw2">public</span> <span class="kw2">class</span> NewsPost <span class="br0">&#123;</span>
    <span class="kw2">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> title;
    <span class="kw2">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> description;
    <span class="kw2">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> date;
    <span class="kw2">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> author;
&nbsp;
    <span class="kw2">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> getTitle<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">return</span> title;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <span class="kw4">void</span> setTitle<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> title<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">this</span>.<span class="me1">title</span> = title;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> getDescription<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">return</span> description;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <span class="kw4">void</span> setDescription<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> description<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">this</span>.<span class="me1">description</span> = description;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> getAuthor<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">return</span> author;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <span class="kw4">void</span> setAuthor<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> author<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">this</span>.<span class="me1">author</span> = author;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> getDate<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">return</span> date;
    <span class="br0">&#125;</span>
    <span class="kw2">public</span> <span class="kw4">void</span> setDate<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> date<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">this</span>.<span class="me1">date</span> = date;
    <span class="br0">&#125;</span>
&nbsp;
<span class="br0">&#125;</span></pre></div></div>
<p>Then in my main activity class I cast the templated ArrayList to a NewsPost class:</p>
<p><strong><strong>ArrayList&lt;NewsPost&gt; spr_news = new ArrayList&lt;NewsPost&gt;();</strong></strong></p>
<p>With the data structure sorted I need a method in my ListView activity to actually fill in the ArrayList with data. This is very typically something along the lines of the following, here I read the JSON data from a URL, decode it and assign it to the class members, finally appending it to the ArrayList from earlier.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jaymz.eu/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="java"><span class="kw2">private</span> <span class="kw4">void</span> getPosts<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">try</span> <span class="br0">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AURL+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">URL</span></a> url = <span class="kw2">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AURL+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">URL</span></a><span class="br0">&#40;</span><span class="st0">&quot;url for data&quot;</span><span class="br0">&#41;</span>;
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ABufferedReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">BufferedReader</span></a> in = <span class="kw2">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ABufferedReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">BufferedReader</span></a><span class="br0">&#40;</span><span class="kw2">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AInputStreamReader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">InputStreamReader</span></a><span class="br0">&#40;</span>url.<span class="me1">openStream</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> str = in.<span class="me1">readLine</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
            in.<span class="me1">close</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
            spr_news = <span class="kw2">new</span> ArrayList&lt;NewsPost&gt;<span class="br0">&#40;</span><span class="br0">&#41;</span>;
            JSONObject json = <span class="kw2">new</span> JSONObject<span class="br0">&#40;</span>str<span class="br0">&#41;</span>;
            JSONArray posts = json.<span class="me1">getJSONArray</span><span class="br0">&#40;</span><span class="st0">&quot;posts&quot;</span><span class="br0">&#41;</span>;
            <span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">int</span> x=<span class="nu0">0</span>; x &lt; posts.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; x++<span class="br0">&#41;</span> <span class="br0">&#123;</span>
                JSONObject post_data = <span class="kw2">new</span> JSONObject<span class="br0">&#40;</span>posts.<span class="me1">get</span><span class="br0">&#40;</span>x<span class="br0">&#41;</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                NewsPost post = <span class="kw2">new</span> NewsPost<span class="br0">&#40;</span><span class="br0">&#41;</span>;
                post.<span class="me1">setTitle</span><span class="br0">&#40;</span>post_data.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;title&quot;</span><span class="br0">&#41;</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                post.<span class="me1">setDescription</span><span class="br0">&#40;</span>post_data.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;description&quot;</span><span class="br0">&#41;</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                post.<span class="me1">setDate</span><span class="br0">&#40;</span>post_data.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;date&quot;</span><span class="br0">&#41;</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                post.<span class="me1">setAuthor</span><span class="br0">&#40;</span>post_data.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;author&quot;</span><span class="br0">&#41;</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                spr_news.<span class="me1">add</span><span class="br0">&#40;</span>post<span class="br0">&#41;</span>;
                <span class="co1">//Log.d(&quot;NEW&quot;, &quot;added a post - &quot;+post.getTitle());</span>
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span> <span class="kw2">catch</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Exception</span></a> e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp;
        <span class="br0">&#125;</span>
        runOnUiThread<span class="br0">&#40;</span>setPosts<span class="br0">&#41;</span>;
    <span class="br0">&#125;</span></pre></div></div><br />
</strong></strong></p>
<p>With all the above in place the code is at the point where there is now an array full of structured data for our ArrayAdapter to show. To do this the ArrayAdapter needs subclassed to work with our earlier NewsPost classes members:</p>
<p><div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jaymz.eu/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="java"><span class="kw2">private</span> <span class="kw2">class</span> NewsAdapter <span class="kw2">extends</span> ArrayAdapter&lt;NewsPost&gt; <span class="br0">&#123;</span>
&nbsp;
        <span class="kw2">private</span> ArrayList&lt;NewsPost&gt; items;
&nbsp;
        <span class="kw2">public</span> NewsAdapter<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AContext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Context</span></a> context, <span class="kw4">int</span> textViewResourceId, ArrayList&lt;NewsPost&gt; items<span class="br0">&#41;</span> <span class="br0">&#123;</span>
                <span class="kw2">super</span><span class="br0">&#40;</span>context, textViewResourceId, items<span class="br0">&#41;</span>;
                <span class="kw2">this</span>.<span class="me1">items</span> = items;
        <span class="br0">&#125;</span>
        @Override
        <span class="kw2">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AView+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> getView<span class="br0">&#40;</span><span class="kw4">int</span> position, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AView+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> convertView, ViewGroup parent<span class="br0">&#41;</span> <span class="br0">&#123;</span>
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AView+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> v = convertView;
                <span class="kw1">if</span> <span class="br0">&#40;</span>v == <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
                    LayoutInflater vi = <span class="br0">&#40;</span>LayoutInflater<span class="br0">&#41;</span>getSystemService<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AContext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Context</span></a>.<span class="me1">LAYOUT_INFLATER_SERVICE</span><span class="br0">&#41;</span>;
                    v = vi.<span class="me1">inflate</span><span class="br0">&#40;</span>R.<span class="me1">layout</span>.<span class="me1">post</span>, <span class="kw2">null</span><span class="br0">&#41;</span>;
                <span class="br0">&#125;</span>
                NewsPost o = items.<span class="me1">get</span><span class="br0">&#40;</span>position<span class="br0">&#41;</span>;
                <span class="kw1">if</span> <span class="br0">&#40;</span>o != <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
                    <span class="coMULTI">/* hmm, this looks proper ugly */</span>
                    TextView title = <span class="br0">&#40;</span>TextView<span class="br0">&#41;</span>v.<span class="me1">findViewById</span><span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">post_title</span><span class="br0">&#41;</span>;
                    TextView description = <span class="br0">&#40;</span>TextView<span class="br0">&#41;</span>v.<span class="me1">findViewById</span><span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">post_description</span><span class="br0">&#41;</span>;
                    TextView date = <span class="br0">&#40;</span>TextView<span class="br0">&#41;</span>v.<span class="me1">findViewById</span><span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">post_date</span><span class="br0">&#41;</span>;
                    TextView author = <span class="br0">&#40;</span>TextView<span class="br0">&#41;</span>v.<span class="me1">findViewById</span><span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">post_author</span><span class="br0">&#41;</span>;
&nbsp;
                    description.<span class="me1">setText</span><span class="br0">&#40;</span>o.<span class="me1">getDescription</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                    title.<span class="me1">setText</span><span class="br0">&#40;</span>o.<span class="me1">getTitle</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                    author.<span class="me1">setText</span><span class="br0">&#40;</span>o.<span class="me1">getAuthor</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                    date.<span class="me1">setText</span><span class="br0">&#40;</span>o.<span class="me1">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
                <span class="br0">&#125;</span>
                <span class="kw2">return</span> v;
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span></pre></div></div>
<p>All this code is really doing is loading the layout resource XML for our row and binding the data from the array elements members to views within the XML. Finally we need to tell the list view to update. Typically the above code has all been kicked off and ran in a thread, populating the ListView when it&#8217;s actually finished without stalling the phone itself.</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jaymz.eu/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="java"><span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">int</span> i=<span class="nu0">0</span>;i&lt;spr_news.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;i++<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    n_adapter.<span class="me1">add</span><span class="br0">&#40;</span>spr_news.<span class="me1">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="br0">&#41;</span>;
<span class="br0">&#125;</span>
m_ProgressDialog.<span class="me1">dismiss</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
n_adapter.<span class="me1">notifyDataSetChanged</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</pre></div></div>
<p>All the above is doing is updating the ArrayAdapter and adding our ArrayList elements to display. We then signal that the data has changed which will cause the ListView itself to update. Simple! <img src='http://jaymz.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Again, I must make the point of how verbose this all feels when I&#8217;m coding in python all day. I&#8217;m sure it needs a good refactor to now but I&#8217;m a lot more familiar with the way android works with layouts and indeed <strong>strong</strong> typing <img src='http://jaymz.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/07/spinemagazine-com-radio-player-news-reader-for-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Blogger to Django integration</title>
		<link>http://jaymz.eu/2010/06/google-blogger-to-django-integration/</link>
		<comments>http://jaymz.eu/2010/06/google-blogger-to-django-integration/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 21:45:57 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[blogger]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=447</guid>
		<description><![CDATA[I&#8217;ve been working a lot on Vans recently and they have a large number of blogs that are currently hosted on the blogger platform. This works really well for them, they have a straightforward &#38; easy to use blog platform that does what they need it to do.  The sites themselves work great as they [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working a lot on <a href="http://www.vans.com">Vans</a> recently and they have a large number of blogs that are currently hosted on the blogger platform. This works really well for them, they have a straightforward &amp; easy to use blog platform that does what they need it to do.  The sites themselves work great as they are but the integration into the main site isn&#8217;t quite as nice.</p>
<p>If you go to the <a href="http://www.vans.com/vans/teamblog.asp">blogs section</a> on vans as it stands it will pull in an XML feed of all the current blogs and display them on one giagantic page. It can take a fair bit of time to load and its hard to see how each different blog gets displayed as its really one big list. For now it&#8217;s not so easy to pull in bits of content from the various blogs without someone having to mess with files or copy &amp; paste, with the build in django I wanted to create a much cleaner &amp; easier way to work with this content.</p>
<p><a href="http://github.com/jaymzcd/django-blogger"><img class="aligncenter size-full wp-image-460" title="blogger-django-logo" src="http://jaymz.eu/wp-content/uploads/2010/06/blogger-django-logo.png" alt="" width="100" height="99" /></a></p>
<p>For this I introduce <a href="http://github.com/jaymzcd/django-blogger">django-blogger</a>, a django application which will integrate Google Blogger blogs via their RSS feeds. As it is it will import the blogs for a given profile id and then sync up with the latest data via their RSS feeds. These can be <a href="http://www.google.com/support/blogger/bin/answer.py?hl=en&amp;answer=97933">enabled easily</a> for your given blogs. When you first install it comes with some admin actions which will all ow you to sync up the blogs manually all at once. There is also a management command, <em>syncblogs,</em> which is more suited to scheduling an update via cron (if you&#8217;re going to use cron you might be interested in <a href="http://code.google.com/p/django-crontab/">django-crontab</a>).</p>
<p><a href="http://jaymz.eu/wp-content/uploads/2010/06/djangoblogs-syncing-command.png"><img class="aligncenter size-full wp-image-451" title="djangoblogs-syncing-command" src="http://jaymz.eu/wp-content/uploads/2010/06/djangoblogs-syncing-command.png" alt="" width="514" height="252" /></a></p>
<p>This works on the feeds and not an archive, so it doesn&#8217;t require authentication, just access to the feed URL. A basic template is included to show how to render out the blog posts &amp; blogs as a menu, I override these myself for the format I need. The app itself now lets me pull content from any of the blogs and use it within the rest of the django based site cleanly &amp; easily. Rather than directly reading and displaying via the feed URL I&#8217;m creating actual objects for each post and blog so it&#8217;s easily extendible also, say to return posts in various formats or pulling images from each blog post to create blog galleries automatically.</p>
<p><img src="http://jaymz.eu/wp-content/uploads/2010/06/blogs-4.png" alt="" /></p>
<p>The code is available from <a href="http://github.com/jaymzcd/django-blogger">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/06/google-blogger-to-django-integration/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using stochastic processes to generate paint type effects in processing.org</title>
		<link>http://jaymz.eu/2010/06/using-stochastic-processes-to-generate-paint-type-effects/</link>
		<comments>http://jaymz.eu/2010/06/using-stochastic-processes-to-generate-paint-type-effects/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 13:38:01 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=413</guid>
		<description><![CDATA[I very much like to play with processing.org when I&#8217;ve got some downtime. I&#8217;ve wrote a small particle engine a while back in the framework and this time I thought I&#8217;d try and do something a little more arty from the outset. My inspiration for this &#8220;sketch&#8221; was the many splatter paintings by Jackson Pollock. [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">I very much like to play with <a href="http://processing.org" target="_blank">processing.org</a> when I&#8217;ve got some downtime. I&#8217;ve wrote a small particle engine a while back in the framework and this time I thought I&#8217;d try and do something a little more arty from the outset. My inspiration for this &#8220;sketch&#8221; was the many splatter paintings by Jackson Pollock. I can remember going to see some of his work at the Tate modern in London quite a long time ago. I had always thought it a bit poor as &#8220;art&#8221; when I was a kid but later on I developed an appreciation for the format. If you have no idea what I&#8217;m talking about, this is an example:</div>
<div style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/06/large_pollock8.jpg"><img class="aligncenter size-full wp-image-416" style="margin-top: 10px; margin-bottom: 10px;" title="large_pollock8" src="http://jaymz.eu/wp-content/uploads/2010/06/large_pollock8.jpg" alt="" width="453" height="337" /></a></div>
<div>Now my sketches don&#8217;t look much like this but I did capture some of that splattering chaotic effect that I wanted. The basic process is very simple, a class called a <em>Walker</em> will randomly make its way across the canvas. As it moves the vector distance of each step is calculated. If the step is big enough it causes a burst of circles to be drawn, each with a slightly random position &amp; varied alpha to give it some texture. To avoid it becoming a little too busy I&#8217;ve limited it to a set palette at runtime which can be regenerated as walkers are added.</div>
<div><a href="http://jaymz.eu/wp-content/uploads/2010/06/pollock-3.png"><img class="aligncenter size-full wp-image-418" style="margin-top: 10px; margin-bottom: 10px;" title="pollock-3" src="http://jaymz.eu/wp-content/uploads/2010/06/pollock-3.png" alt="" width="441" height="332" /></a></div>
<p>I was quite happy with the random scatter effect as different pools of colour made their way through the canvas space. I thought it would be a nice addition to add in some basic boundary conditions so I added a quick polygon class and added in an array of those. A few functions later and I could click around the screen defining new polygons. Using the well known <a href="http://en.wikipedia.org/wiki/Jordan_curve_theorem">Jordan Curve</a> <span style="color: #551a8b;"><span style="color: #000000;">theorem</span></span> we can tell if the walker is currently within an arbitrary polygon (without holes of course). Here&#8217;s an example video of it in action. Heart&#8217;s seem pretty easy to draw compared to anything crazy complex and give a good idea of the effect:</p>
<div align="center" style="margin-top:10px;margin-bottom:10px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/Pa7tAKXAKF0" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/Pa7tAKXAKF0"></embed></object></div>
<div>I&#8217;ve added quite a few options to the code now allowing me to switch on &amp; off the boundaries as well as add an arbitrary number of polygons. If the vertices overlap then the way the &#8220;point in polygon&#8221; algorithm works it will flag each &#8220;contained&#8221; area as a solid.</div>
<div align="center" style="margin-top:10px;margin-bottom:10px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/ISikETUOUZ8" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/ISikETUOUZ8"></embed></object></div>
<div>Finally here is a nicely captured heart shape. It gives a nice idea of the kind of effect when combined with a boundary. I think playing around with the way the walkers are coded could be fun, for example doing a neighbour check and tweaking the randomised movement accordingly could create a weak flocking style system with Brownian motion driving it.</div>
<div><a href="http://jaymz.eu/wp-content/uploads/2010/06/pollock-heart.png"><img class="aligncenter size-full wp-image-432" style="margin-top: 10px; margin-bottom: 10px;" title="pollock-heart" src="http://jaymz.eu/wp-content/uploads/2010/06/pollock-heart.png" alt="" width="570" height="450" /></a></div>
<div style="text-align: left;">If you&#8217;re interested in checking the code out you can <a href="http://github.com/jaymzcd/processing-grafwalker">find it over on github</a>. It should run for you ok out of the box within your processing environment.</div>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/06/using-stochastic-processes-to-generate-paint-type-effects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eurovision 2010 review (of sorts)</title>
		<link>http://jaymz.eu/2010/05/eurovision-2010-review/</link>
		<comments>http://jaymz.eu/2010/05/eurovision-2010-review/#comments</comments>
		<pubDate>Mon, 31 May 2010 00:17:14 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[musing]]></category>
		<category><![CDATA[eurovision]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=380</guid>
		<description><![CDATA[It&#8217;s widely known amongst my friends that I absolutely love the Eurovision song contest. Growing up with a father that was obsessed with war movies my early formative years tended to view europe like this: Europe for me as a young child was world war Europe. I&#8217;d always thought of the many different countries as totally [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s widely known amongst my friends that I absolutely love the <a href="http://en.wikipedia.org/wiki/Eurovision_Song_Contest">Eurovision</a> song contest. Growing up with a father that was obsessed with war movies my early formative years tended to view europe like this:</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/05/ww21.jpg"><img class="aligncenter size-full wp-image-404" title="ww2" src="http://jaymz.eu/wp-content/uploads/2010/05/ww21.jpg" alt="" width="400" height="413" /></a></p>
<p>Europe for me as a young child was <em>world war Europe</em>.<em> </em>I&#8217;d always thought of the many different countries as totally separate and thought the huge amount of cultural difference a difficult thing to placate, especially growing up in Northern Ireland where even people in the <em>same</em> country hated each other.</p>
<p>Then one evening my parents put on BBC1 and bemoaned that &#8220;Eurovision&#8221; was coming on. I&#8217;d no idea what it was and after being told &#8220;it&#8217;s a singing competition for countries in Europe&#8221; I was significantly intrigued enough to demand to watch it. After a few hours I&#8217;d decided that this programme alone was responsible for the prevention of world war 3 and began to see Europe more like this:</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/05/postev.jpg"><img class="aligncenter size-full wp-image-411" title="postev" src="http://jaymz.eu/wp-content/uploads/2010/05/postev.jpg" alt="" width="480" height="320" /></a></p>
<p>The reason I believe what many consider a giant waste of time to be the reason we&#8217;re not all living under the fourth Reich is simple. If you actually watch the show it&#8217;s hard to not get a sense of communal euro-love throughout.<span id="more-380"></span>Each country might be several million people but it all feels like each country is a single entity standing there at this casual party where you&#8217;re encouraged to be a bit crazy. I feel like the idea we all get together once a year to play some music and get to know each other some more does actually help cohesion. I like eurovision more for the unique window into Europe than the music. The music&#8217;s always been a little hard to love but recently there&#8217;s been a lot more diversity to the musical selection and this year there were more than a few standout songs for me.</p>
<p>But just before that, if you are still in doubt as to why watch Eurovision you should also realise it serves as a giant display of the amazing female talent that makes Europe such a kick ass bunch of countries. I am reminded about what is so awesome about being in an EU member state and being allowed to travel around it freely. If I wanted, I could get on a train tomorrow and go move to Germany to work. Damn I love the concept of open borders.</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/05/girlsofeurovision2010.jpg"><img class="aligncenter size-full wp-image-397" title="girlsofeurovision2010" src="http://jaymz.eu/wp-content/uploads/2010/05/girlsofeurovision2010.jpg" alt="" width="600" /></a></p>
<p>I suppose I should mention at least a few tunes, firstly, Turkey went out there again this year and dropped a rock number for their entry. They had a similiarly themed tune last year which I quite liked. This is their 2010 entry and it&#8217;s worth a listen all on its own.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/IFWXTxaTI-Q&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/IFWXTxaTI-Q&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Bosnia really surprised me too with their entry, again it&#8217;s fairly rocky. It reminds me of Azerbaijan&#8217;s entry in 2008. I&#8217;m not quite sure why but I really like the non-english accent english vocal sound. Most probably hate it but there&#8217;s something about the vocals I like in this.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/tfzrpx-_R8s&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/tfzrpx-_R8s&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The actual winning entry this year was from Germany, which is kind of a surprise as they&#8217;re one of the &#8220;big four&#8221;, they normally tend to get shunned as part of the &#8220;establishment&#8221;. As much as it pains me to admit it, I do find this song irritatingly catchy, and the girl, Lena, is proper gorgeous. She also comes across as a cooky crazy girl, which is good&#8230;</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/8QSgNM9yNjo&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/8QSgNM9yNjo&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>A final honourable mention to Denmark, who&#8217;s song this year put me in mind of Sting. This I could imagine in some 90&#8242;s montage shot with windswept hair.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/D3rFwslBNk0&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/D3rFwslBNk0&amp;hl=en_GB&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The UK ended up in last place, the bloke singing did seem to be a genuinely nice guy but the song itself was utter shite. Ireland played an experienced hand, having a woman that had previously won it for us before. It was pretty boring, run of the mill fare although made a welcome change from the now usual joke entry. Hell, I think this was our first final in 3 years. If you are in the mood for old fashioned europop cheese then do checkout <a href="http://www.youtube.com/watch?v=z8fmCZW3vPk">Greece&#8217;s entry &#8220;Opa!&#8221;</a>. I thought for a minute Bruce Willis had entered.</p>
<p><a href="http://jaymz.eu/wp-content/uploads/2010/05/opa-willis.jpg"><img class="aligncenter size-full wp-image-407" title="opa-willis" src="http://jaymz.eu/wp-content/uploads/2010/05/opa-willis.jpg" alt="" width="640" height="300" /></a></p>
<p>Considering that the competition is going to be in Berlin in 2011 I&#8217;m actually tempted to make my way over there. I have to go see it live at lease once in my life I think. Huzzah for Eurovision, may it long continue. Because if it&#8217;s not on, we&#8217;re probably at fucking war.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/05/eurovision-2010-review/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django Reference in android market now</title>
		<link>http://jaymz.eu/2010/05/django-reference-in-android-market-now/</link>
		<comments>http://jaymz.eu/2010/05/django-reference-in-android-market-now/#comments</comments>
		<pubDate>Fri, 28 May 2010 13:36:20 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://jaymz.eu/2010/05/django-reference-in-android-market-now/</guid>
		<description><![CDATA[Very late last night, as I was enjoying &#8220;The Design &#38; Evolution of C++&#8221; (an excellent book, even if you&#8217;re not a C++ dev), I took a short break and was browsing around on the android market place and noticed there was no django app. I&#8217;ve recently picked up an HTC desire and have been [...]]]></description>
			<content:encoded><![CDATA[<p>Very late last night, as I was enjoying &#8220;<a href="http://www.amazon.co.uk/Design-Evolution-C-Bjarne-Stroustrup/dp/0201543303/ref=sr_1_2?ie=UTF8&amp;s=books&amp;qid=1275053838&amp;sr=8-2">The Design &amp; Evolution of C++</a>&#8221; (an excellent book, even if you&#8217;re not a C++ dev), I took a short break and was browsing around on the android market place and noticed there was no django app. I&#8217;ve recently picked up an HTC desire and have been really enjoying developing on it. I&#8217;m currently working on an application for Crooked Tongues to allow people to post &amp; comment their sneakers (don&#8217;t ask&#8230;) and I thought this would be a quick app to do and get out there. Anyone starting out developing apps will be aware that one of the hardest things is just thinking of something that isn&#8217;t already crowded out by what&#8217;s already available.</p>
<p>Basically, all I wanted was a more dedicated browser for the django docs. The content there is excellent so I quickly knocked together an application that lets you jump to major sections, set a page zoom by default and switch version easily. All in all it only took a few hours of development and thanks to the approval procedure it&#8217;s already available to install.</p>
<p><a href="http://jaymz.eu/wp-content/uploads/2010/05/icon.png"><img class="aligncenter size-full wp-image-373" title="icon" src="http://jaymz.eu/wp-content/uploads/2010/05/icon.png" alt="" width="180" height="180" /></a></p>
<p>It&#8217;s a glorified web view but it&#8217;s a start point and its at least out there now. I&#8217;m getting a lot more used to the dev process now on android. The total code for this app weighs in around 400 lines &#8211; around 80 of those being XML to define the layout and strings used. The main activity class then manipulates the XML defined webview component to react to the (again XML) menu. My main constructor method looks like this:</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jaymz.eu/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jaymz.eu/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="java">@Override
    <span class="kw2">public</span> <span class="kw4">void</span> onCreate<span class="br0">&#40;</span>Bundle savedInstanceState<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        Resources res = getResources<span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp;
        version = res.<span class="me1">getString</span><span class="br0">&#40;</span>R.<span class="me1">string</span>.<span class="me1">default_version</span><span class="br0">&#41;</span>;
        base_url = res.<span class="me1">getString</span><span class="br0">&#40;</span>R.<span class="me1">string</span>.<span class="me1">url_base</span><span class="br0">&#41;</span>;
&nbsp;
        <span class="kw2">super</span>.<span class="me1">onCreate</span><span class="br0">&#40;</span>savedInstanceState<span class="br0">&#41;</span>;
        setContentView<span class="br0">&#40;</span>R.<span class="me1">layout</span>.<span class="me1">main</span><span class="br0">&#41;</span>;
        webview = <span class="br0">&#40;</span>WebView<span class="br0">&#41;</span> findViewById<span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">webview</span><span class="br0">&#41;</span>;
&nbsp;
        webview.<span class="me1">getSettings</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">setJavaScriptEnabled</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span>;
        webview.<span class="me1">setWebViewClient</span><span class="br0">&#40;</span><span class="kw2">new</span> DjangoWebClient<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
&nbsp;
        <span class="kw2">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AView+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> zc = webview.<span class="me1">getZoomControls</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
        FrameLayout mContentView = <span class="br0">&#40;</span>FrameLayout<span class="br0">&#41;</span> getWindow<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getDecorView</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">findViewById</span><span class="br0">&#40;</span>android.<span class="me1">R</span>.<span class="me1">id</span>.<span class="me1">content</span><span class="br0">&#41;</span>;
        mContentView.<span class="me1">addView</span><span class="br0">&#40;</span>zc, ZOOM_PARAMS<span class="br0">&#41;</span>;
        zc.<span class="me1">setVisibility</span><span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AView+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a>.<span class="me1">GONE</span><span class="br0">&#41;</span>;
&nbsp;
        setZoom<span class="br0">&#40;</span><span class="br0">&#41;</span>;
        loadDocs<span class="br0">&#40;</span><span class="br0">&#41;</span>;
    <span class="br0">&#125;</span></pre></div></div>
<p>The remainder of the methods are basically just reacting to the menu choices and directing the webview url appropriately. All in all quite simple.</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/05/release.png"><img class="aligncenter size-full wp-image-377" title="release" src="http://jaymz.eu/wp-content/uploads/2010/05/release.png" alt="" width="560" height="336" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/05/django-reference-in-android-market-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Chrome extension for TFL data</title>
		<link>http://jaymz.eu/2010/05/google-chrome-extension-for-tfl-data/</link>
		<comments>http://jaymz.eu/2010/05/google-chrome-extension-for-tfl-data/#comments</comments>
		<pubDate>Tue, 18 May 2010 00:38:47 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=353</guid>
		<description><![CDATA[I have been coding in java for about a week now (when I&#8217;m not coding in Python of course) and I fancied a break away from it. I&#8217;m not entirely sure why but I decided to take a look at coding chrome extensions. These are in fact very, very easy to make. The tube status [...]]]></description>
			<content:encoded><![CDATA[<p>I have been coding in java for about a week now (when I&#8217;m not coding in Python of course) and I fancied a break away from it. I&#8217;m not entirely sure why but I decided to take a look at coding chrome extensions. These are in fact very, very easy to make. The tube status thing below took me just over an hour to get how I wanted. If you&#8217;re running chrome you can get the installer here. I think I&#8217;ll do some more work on it to add customization &#8211; that was my initial motivation to do this, the first one I installed from the current extension gallery just showed the little panel of status&#8217; from the site and I wanted to just pick a few lines &amp; tweak the output.</p>
<p><a href="https://chrome.google.com/extensions/detail/mholkbelnpdjcfleagoeomkcojplfngn"><img class="aligncenter size-full wp-image-360" title="data" src="http://jaymz.eu/wp-content/uploads/2010/05/data.png" alt="" width="416" height="556" /></a></p>
<p>In the end it&#8217;s easier to just code my own. It makes use of the excellent <a href="http://tubeupdates.com/">REST api</a> provided by <a href="http://www.bendodson.com/">Ben Dodson</a>. Creating such an extension is trivial. You can make your life a bit easier if you just include jquery from the google ajax api&#8217;s. Then its really just a collection of a few html files (in this case just the one popup.html). All my HTML is doing is making an AJAX request for the JSON data from Ben&#8217;s api. That comes back and it simply renders out a few div&#8217;s with the colors set and based on the status a unicode entity to add some fun to it.</p>
<p>The <a href="http://code.google.com/chrome/extensions/overview.html">method of making extensions</a> on chrome really is a breeze and the documentation is plentiful, so hats off to google yet again for making me happy to be an open source, linux loving  developer. The extension is now in the chrome gallery and <a href="https://chrome.google.com/extensions/detail/mholkbelnpdjcfleagoeomkcojplfngn">available here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/05/google-chrome-extension-for-tfl-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crooked Tongues TIA android app &#8211; Week 1</title>
		<link>http://jaymz.eu/2010/05/crooked-tongues-tia-android-app-week-1/</link>
		<comments>http://jaymz.eu/2010/05/crooked-tongues-tia-android-app-week-1/#comments</comments>
		<pubDate>Sun, 16 May 2010 23:22:14 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=346</guid>
		<description><![CDATA[I recently picked up an HTC desire and have been loving android as a platform. I&#8217;m not entirely sure why I didn&#8217;t go for android to begin with (apart from doing my friend Spangsberg a favour by buying out his iPhone contract before he left the country). I dabbled a little with objective C but [...]]]></description>
			<content:encoded><![CDATA[<p>I recently picked up an HTC desire and have been loving android as a platform. I&#8217;m not entirely sure why I didn&#8217;t go for android to begin with (apart from doing my friend Spangsberg a favour by buying out his iPhone contract before he left the country). I dabbled a little with objective C but not owning a full on mac for dev&#8217;ing put me off spending a significant time at home coding for the device. That and it seemed like a lot of work to get going (probably because I use Linux almost all day so am not used to the Mac toolchain).</p>
<p>Working with android on linux has been a total pleasure. Mostly. I&#8217;m still getting re-used to the verbosity of java compared to my day-to-day python but the experiance has been a good one so far. I&#8217;ve basically been learning by looking at the sample apps supplied combined with a lot of googling and reading of android dev forums. There is a real wealth of documentation out there and there&#8217;s an absolute ton of general java code to solve most problems. This is where I&#8217;m at about a week into it (spending a couple of hours every few days on it).</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/05/tia-updated.png"><img class="aligncenter size-full wp-image-347" title="tia-updated" src="http://jaymz.eu/wp-content/uploads/2010/05/tia-updated.png" alt="" width="448" height="336" /></a></p>
<p>The HTTP posts are working now as is uploading a camera shot, you can store user/passwords and then it&#8217;ll do the form posts with that data. For now I have it just &#8220;logging&#8221; in to a dummy setup on my own server &#8211; that side is just some PHP for now. The real backend runs python (django), for now its just easier to run that data through some PHP on my blog server. The data for the views comes via a JSON array, that data is served up via python and is essentially just a REST interface to the TIA area. I&#8217;m mainly concentrating on just learning my way around the SDK but already I&#8217;m seeing that theres a lot of power in combining the android platform with django (and maybe django-pistons on top) to create rather powerful connected mobile apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/05/crooked-tongues-tia-android-app-week-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pro dominos ordering 101</title>
		<link>http://jaymz.eu/2010/05/pro-dominos-ordering-101/</link>
		<comments>http://jaymz.eu/2010/05/pro-dominos-ordering-101/#comments</comments>
		<pubDate>Sun, 09 May 2010 13:22:21 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[musing]]></category>
		<category><![CDATA[food]]></category>

		<guid isPermaLink="false">http://jaymz.eu/?p=341</guid>
		<description><![CDATA[As a coder I tend to not eat as well as I could. I grew up on a diet of home made stews, casseroles, soups and lots more irishy &#8220;proper&#8221; food. Then I moved to London and got a job. At one point, when I actually lived with other people, I would occasionally cook, but [...]]]></description>
			<content:encoded><![CDATA[<p>As a coder I tend to not eat as well as I could. I grew up on a diet of home made stews, casseroles, soups and lots more irishy &#8220;proper&#8221; food. Then I moved to London and got a job. At one point, when I actually lived with other people, I would occasionally cook, but since I moved in on my own I end up eating out a hell of a lot more than I probably should.</p>
<p>Anyway, for sunday style coding sessions I tend to like just zoning out with a pizza and a bottle of pepsi max. I don&#8217;t rate pizza hut and papa johns don&#8217;t deliver here so dominos is my preferred major pizza chain retailer. Anyone that&#8217;s ever bought a pizza from them will know that they&#8217;re fucking expensive! It can easily run you £16+ for a &#8220;large&#8221; pizza. But only a total internet noob would order straight up without checking out the many voucher sites. I say many, I only ever check <a href="http://retailmenot.com">retailmenot.com</a> (or voucherhub as its UK site is known). This gem just got me the pizza + more for less than the actual pizza <em>SGBLFENR</em>.</p>
<p style="text-align: center;"><a href="http://jaymz.eu/wp-content/uploads/2010/05/dominos-discounts.png"><img class="aligncenter size-full wp-image-342" title="dominos-discounts" src="http://jaymz.eu/wp-content/uploads/2010/05/dominos-discounts.png" alt="" width="589" height="339" /></a></p>
<p>It can seem a bit of a waste but you might as well have the money than dominos. And if you&#8217;re a social type that has someone else in the house you can be all sharing and get a warm glow inside.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/05/pro-dominos-ordering-101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
