<?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"
	>

<channel>
	<title>Trouble With Dreams &#187; code</title>
	<atom:link href="http://troublewithdreams.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://troublewithdreams.com</link>
	<description></description>
	<pubDate>Mon, 05 Jan 2009 14:05:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Extremely Slow Track Chart Updating</title>
		<link>http://troublewithdreams.com/2009/01/05/extremely-slow-track-chart-updating/</link>
		<comments>http://troublewithdreams.com/2009/01/05/extremely-slow-track-chart-updating/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 14:04:00 +0000</pubDate>
		<dc:creator>sam</dc:creator>
		
		<category><![CDATA[scrobbler]]></category>

		<guid isPermaLink="false">http://troublewithdreams.com/?p=223</guid>
		<description><![CDATA[Should be alleviated - an unindexed query called for each track in a chart list was returning close to a million rows = ouch and hurrah for indexes.
]]></description>
			<content:encoded><![CDATA[<p>Should be alleviated - an unindexed query called for each track in a chart list was returning close to a million rows = ouch and hurrah for indexes.</p>
]]></content:encoded>
			<wfw:commentRss>http://troublewithdreams.com/2009/01/05/extremely-slow-track-chart-updating/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Life in the Stencil Buffer</title>
		<link>http://troublewithdreams.com/2008/11/25/life-in-the-stencil-buffer/</link>
		<comments>http://troublewithdreams.com/2008/11/25/life-in-the-stencil-buffer/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 13:46:29 +0000</pubDate>
		<dc:creator>sam</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[silly]]></category>

		<guid isPermaLink="false">http://troublewithdreams.com/?p=215</guid>
		<description><![CDATA[Stumbling through a load of OpenGL documentation I came across a demonstration of Conway&#8217;s Game of Life using the stencil buffer, which is simultaneously awesome and horrible:
Life in the Stencil Buffer
One way to create this game using OpenGL is to use a multipass algorithm. Keep the data in the color buffer, one pixel for each [...]]]></description>
			<content:encoded><![CDATA[<p>Stumbling through a load of OpenGL documentation I came across a demonstration of Conway&#8217;s <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Game of Life</a> using the stencil buffer, which is simultaneously awesome and horrible:</p>
<blockquote><h3>Life in the Stencil Buffer</h3>
<p>One way to create this game using OpenGL is to use a multipass algorithm. Keep the data in the color buffer, one pixel for each grid point. Assume that black (all zeros) is the background color, and the color of a live pixel is nonzero. Initialize by clearing the depth and stencil buffers to zero, set the depth-buffer writemask to zero, and set the depth comparison function so that it passes on not-equal. To iterate, read the image off the screen, enable drawing into the depth buffer, and set the stencil function so that it increments whenever a depth comparison succeeds but leaves the stencil buffer unchanged otherwise. Disable drawing into the color buffer.</p>
<p>Next, draw the image eight times, offset one pixel in each vertical, horizontal, and diagonal direction. When you&#8217;re done, the stencil buffer contains a count of the number of live neighbors for each pixel. Enable drawing to the color buffer, set the color to the color for live cells, and set the stencil function to draw only if the value in the stencil buffer is 3 (three live neighbors). In addition, if this drawing occurs, decrement the value in the stencil buffer. Then draw a rectangle covering the image; this paints each cell that has exactly three live neighbors with the “alive” color.</p>
<p>At this point, the stencil buffers contain 0, 1, 2, 4, 5, 6, 7, 8, and the values under the 2&#8217;s are correct. The values under 0, 1, 4, 5, 6, 7, and 8 must be cleared to the “dead” color. Set the stencil function to draw whenever the value is not 2, and to zero the stencil values in all cases. Then draw a large polygon of the “dead” color across the entire image. You&#8217;re done.</p>
</blockquote>
<p><a href="http://www710.univ-lyon1.fr/~jciehl/Public/OpenGL_PG/ch15.html#id5553768">http://www710.univ-lyon1.fr/~jciehl/Public/OpenGL_PG/ch15.html#id5553768</a></p>
]]></content:encoded>
			<wfw:commentRss>http://troublewithdreams.com/2008/11/25/life-in-the-stencil-buffer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Last.fm Historical Charts v2</title>
		<link>http://troublewithdreams.com/2008/08/21/lastfm-historical-charts-v2/</link>
		<comments>http://troublewithdreams.com/2008/08/21/lastfm-historical-charts-v2/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 23:21:34 +0000</pubDate>
		<dc:creator>sam</dc:creator>
		
		<category><![CDATA[last.fm]]></category>

		<category><![CDATA[scrobbler]]></category>

		<guid isPermaLink="false">http://troublewithdreams.com/?p=200</guid>
		<description><![CDATA[I updated my historical charts program to allow album and track charts, make it utf8 compatible and give it a graphical overhaul too, hurrahs all round.
Same process as before - when you first create each kind of chart it&#8217;ll take a while to fetch your data, subsequent charts will be created a whole lot faster. [...]]]></description>
			<content:encoded><![CDATA[<p>I updated my historical charts program to allow album and track charts, make it utf8 compatible and give it a graphical overhaul too, hurrahs all round.</p>
<p>Same process as before - when you first create each kind of chart it&#8217;ll take a while to fetch your data, subsequent charts will be created a whole lot faster.  Eventually I&#8217;ll make a script to purge the data stored for anybody who hasn&#8217;t used the program in a couple of months so keep popping back if you get fed up with the waits.</p>
<p>As always comments are welcome.  Oh and suggestions for a better name too..</p>
]]></content:encoded>
			<wfw:commentRss>http://troublewithdreams.com/2008/08/21/lastfm-historical-charts-v2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LastFM Charts</title>
		<link>http://troublewithdreams.com/2008/03/18/lastfm-charts/</link>
		<comments>http://troublewithdreams.com/2008/03/18/lastfm-charts/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 03:05:34 +0000</pubDate>
		<dc:creator>sam</dc:creator>
		
		<category><![CDATA[last.fm]]></category>

		<category><![CDATA[scrobbler]]></category>

		<guid isPermaLink="false">http://troublewithdreams.com/2008/03/18/lastfm-charts/</guid>
		<description><![CDATA[I made my program to generate charts for any date range from LastFM data available to anybody a few weeks ago and it&#8217;s had a positive response, being included on build.last.fm as an interesting extra kindofthing.  Though still nobody has feedback or suggestions.  Maybe in itself it&#8217;s relatively complete and I should think [...]]]></description>
			<content:encoded><![CDATA[<p>I made my <a href="/scrobbler/">program to generate charts for any date range</a> from LastFM data <a href="http://www.last.fm/user/aradnuk/journal/2008/02/23/656429/">available to anybody</a> a few weeks ago and it&#8217;s had a positive response, being included on <a href="http://build.last.fm">build.last.fm</a> as an interesting extra kindofthing.  Though still nobody has feedback or suggestions.  Maybe in itself it&#8217;s relatively complete and I should think of other, related bits and pieces.  Anybody?</p>
<p>I&#8217;ve made it automatically updating, so you only need to add your data once the very first time you visit, and after that it&#8217;ll check whether there should be new charts available.  Maybe it should only happen a few days into the week - LastFM never get the charts out on time after all..</p>
<p>That and I added a few extra quick links, to 3/6/12/24 months previous.  No more &#8216;wait a month for charts to refresh&#8217; ;-).  I should totally see if I can make this into a greasemonkey script..</p>
<p>PHP&#8217;s <code>strtotime</code> function is no end of brilliance - <code>strtotime("-6 months")</code> and <code>strtotime("last sunday")</code> are genius conceptions.</p>
]]></content:encoded>
			<wfw:commentRss>http://troublewithdreams.com/2008/03/18/lastfm-charts/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hit F5</title>
		<link>http://troublewithdreams.com/2007/02/23/32/</link>
		<comments>http://troublewithdreams.com/2007/02/23/32/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 17:48:02 +0000</pubDate>
		<dc:creator>sam</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://troublewithdreams.com/?p=32</guid>
		<description><![CDATA[
Cool, huh?
]]></description>
			<content:encoded><![CDATA[<p><?php include('http://www.troublewithdreams.com/includes/lastfm/show.php'); ?></p>
<p>Cool, huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://troublewithdreams.com/2007/02/23/32/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fly Me Away</title>
		<link>http://troublewithdreams.com/2006/12/22/fly-me-away/</link>
		<comments>http://troublewithdreams.com/2006/12/22/fly-me-away/#comments</comments>
		<pubDate>Fri, 22 Dec 2006 01:39:38 +0000</pubDate>
		<dc:creator>sam</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://troublewithdreams.com/?p=26</guid>
		<description><![CDATA[A dead router == little opportunity to post.
Python is an awesome programming language and this is an awesome site.  Currently stuck on level six.  It can all only add to my super vocabulary of acronyms (which currently includes RISC, MIPS, RAM, ROM and POST) that my textbook -promised- me would make my friends [...]]]></description>
			<content:encoded><![CDATA[<p>A dead router == little opportunity to post.</p>
<p>Python is an awesome programming language and <a href="http://www.pythonchallenge.com">this</a> is an awesome site.  Currently stuck on level six.  It can all only add to my super vocabulary of acronyms (which currently includes RISC, MIPS, RAM, ROM and POST) that my textbook -promised- me would make my friends think me supercool and totally infallible.</p>
<p>And it has list comprehensions!</p>
]]></content:encoded>
			<wfw:commentRss>http://troublewithdreams.com/2006/12/22/fly-me-away/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
