<?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 &#187; java</title>
	<atom:link href="http://jaymz.eu/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://jaymz.eu</link>
	<description></description>
	<lastBuildDate>Tue, 14 Feb 2012 11:52:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<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>4</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_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="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_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">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_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="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_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="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>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>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_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">@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>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>Beginnings of a particle system in processing</title>
		<link>http://jaymz.eu/2010/02/beginnings-of-a-particle-system-in-processing/</link>
		<comments>http://jaymz.eu/2010/02/beginnings-of-a-particle-system-in-processing/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 01:30:36 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[graphics]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[particles]]></category>

		<guid isPermaLink="false">http://www.jaymz.eu/?p=131</guid>
		<description><![CDATA[I have been getting more &#38; more into processing and who doesn&#8217;t love particles? I&#8217;ve started the basis of a little particle system, there are plenty of examples at openprocessing.org but I wanted to write my own as an exercise. It&#8217;s been quite some time since I properly used even pretty basic maths for physics [...]]]></description>
			<content:encoded><![CDATA[<p>I have been getting more &amp; more into processing and who doesn&#8217;t love particles? I&#8217;ve started the basis of a little particle system, there are plenty of examples at openprocessing.org but I wanted to write my own as an exercise. It&#8217;s been quite some time since I properly used even pretty basic maths for physics so I&#8217;ve been enjoying revisting old uni notes &amp; following through my old engineering books.</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/OVWIwL_V-jY&amp;hl=en_GB&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/OVWIwL_V-jY&amp;hl=en_GB&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I have it colliding in a rough way with the walls. There&#8217;s no horizontal component to forces yet, it just drifts as time increases rather than falling straight down. It goes crazy as I&#8217;m changing the &#8220;gravity&#8221; throughout. Hopefully this will continue to grow as I add bits and (re)learn the concepts. So far this probably about 100-150 lines of code, not a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/02/beginnings-of-a-particle-system-in-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Old school demo effects: #1 &#8211; the plasma</title>
		<link>http://jaymz.eu/2010/01/playing-with-processing/</link>
		<comments>http://jaymz.eu/2010/01/playing-with-processing/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 19:43:56 +0000</pubDate>
		<dc:creator>jaymz</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.jaymz.eu/?p=7</guid>
		<description><![CDATA[I have finally gotten around to playing with processing &#8211; a java based set of libraries and functions for visual programming. It&#8217;s really a lot of fun. It&#8217;s great for doing quick and easy interactive visualizations. With minimum code you can start drawing simple geometric shapes and when you start throwing around a few sine [...]]]></description>
			<content:encoded><![CDATA[<p>I have finally gotten around to playing with <a title="Processing.org site" href="http://processing.org">processing</a> &#8211; a java based set of libraries and functions for visual programming. It&#8217;s really a lot of fun. It&#8217;s great for doing quick and easy interactive visualizations. With minimum code you can start drawing simple geometric shapes and when you start throwing around a few sine curves and mouse co-ordinates you&#8217;d be surprised what can come out.</p>
<p>One thing I&#8217;ve always promised myself I&#8217;d code was a plasma effect. A stalwart of the 8-bit demoscene I&#8217;m not sure why it&#8217;s taken so long for me to get round to actually coding one from scratch. As you can guess, processing made it pretty straightforward. Here&#8217;s the result:</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/HKW25JkNW9k&amp;hl=en_GB&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/HKW25JkNW9k&amp;hl=en_GB&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>This plasma harks back to one of the first group assignments I had at university where we were given an FPGA and we had to load in a picture of Lena and do something with it. The plasma never materialised, instead we ended up doing a convolution kernel. I can remember we had around 2 weeks to do it (teams of 4 or 5) and write a little report. I wrote this in the space of an hour or two.</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/4ifGdvC4b1k&amp;hl=en_GB&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/4ifGdvC4b1k&amp;hl=en_GB&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>If you&#8217;ve never used it before and have always wanted to do a bit of abstract graphical programming I&#8217;d highly recommend it. The core keywords/methods are all pretty sensible and once you&#8217;ve worked through a few basic &#8220;sketches&#8221; the whole thing begins to gel easily and you start thinking less about the <em>code</em> and more about what you want to do on screen.</p>
<p>Here are a few images I&#8217;ve created via scanning each sampled point and matching it with others in the image within a threshold. A bezier line then connects the points.</p>

<div class="ngg-galleryoverview" id="ngg-gallery-1-7">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-1" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://jaymz.eu/wp-content/gallery/processing/0112-000247.jpg" title=" " class="shutterset_set_1" >
								<img title="0112-000247" alt="0112-000247" src="http://jaymz.eu/wp-content/gallery/processing/thumbs/thumbs_0112-000247.jpg" width="75" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-2" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://jaymz.eu/wp-content/gallery/processing/cream.jpg" title=" " class="shutterset_set_1" >
								<img title="cream" alt="cream" src="http://jaymz.eu/wp-content/gallery/processing/thumbs/thumbs_cream.jpg" width="75" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-3" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://jaymz.eu/wp-content/gallery/processing/round.png" title=" " class="shutterset_set_1" >
								<img title="round" alt="round" src="http://jaymz.eu/wp-content/gallery/processing/thumbs/thumbs_round.png" width="75" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-4" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://jaymz.eu/wp-content/gallery/processing/girl-30.png" title=" " class="shutterset_set_1" >
								<img title="girl-30" alt="girl-30" src="http://jaymz.eu/wp-content/gallery/processing/thumbs/thumbs_girl-30.png" width="100" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-5" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://jaymz.eu/wp-content/gallery/processing/photo-by-circles.png" title=" " class="shutterset_set_1" >
								<img title="photo-by-circles" alt="photo-by-circles" src="http://jaymz.eu/wp-content/gallery/processing/thumbs/thumbs_photo-by-circles.png" width="80" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-6" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://jaymz.eu/wp-content/gallery/processing/spiral-sampled-linedraw.png" title=" " class="shutterset_set_1" >
								<img title="spiral-sampled-linedraw" alt="spiral-sampled-linedraw" src="http://jaymz.eu/wp-content/gallery/processing/thumbs/thumbs_spiral-sampled-linedraw.png" width="100" height="75" />
							</a>
		</div>
	</div>
	
		
 	 	
	<!-- Pagination -->
 	<div class='ngg-clear'></div>
 	
</div>


]]></content:encoded>
			<wfw:commentRss>http://jaymz.eu/2010/01/playing-with-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

