<?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>XZIST.org Blog &#187; programming</title>
	<atom:link href="http://xzist.org/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://xzist.org/blog</link>
	<description></description>
	<lastBuildDate>Fri, 03 Sep 2010 10:18:09 +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>JavaScript: Forwarding to another page after downloading</title>
		<link>http://xzist.org/blog/2009/09/javascript-forwarding-to-another-page-after-downloading/</link>
		<comments>http://xzist.org/blog/2009/09/javascript-forwarding-to-another-page-after-downloading/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 19:55:56 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://xzist.org/blog/?p=195</guid>
		<description><![CDATA[If you have a link to download a file (e.g. a piece of software), you may want to redirect to another page after the user clicks the link, perhaps to gather download statistics or display a message to the user. Setting the window.location in an onclick event for that link does not work, as the [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a link to download a file (e.g. a piece of software), you may want to redirect to another page after the user clicks the link, perhaps to gather download statistics or display a message to the user. Setting the window.location in an onclick event for that link does not work, as the opening &#8220;download&#8221; dialog seems to cancel that action.</p>
<p>Instead use a delay:</p>
<blockquote><p>
&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>function RedirectAfterDownload()<br />
{<br />
window.location = &#8220;http://google.com&#8221;;<br />
}</p>
<p>function OnDownloadClick()<br />
{<br />
// redirects after 1 second<br />
setTimeout(&#8216;RedirectAfterDownload()&#8217;, 1000);<br />
}</p>
<p>&lt;/script&gt;</p>
<p>Then to use: &lt;a href=&#8221;myfile.exe&#8221; onclick=&#8221;OnDownloadClick();&#8221;&gt;Download File!&lt;/a&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://xzist.org/blog/2009/09/javascript-forwarding-to-another-page-after-downloading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We have a bug!</title>
		<link>http://xzist.org/blog/2009/07/we-have-a-bug/</link>
		<comments>http://xzist.org/blog/2009/07/we-have-a-bug/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 09:43:56 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[game dev]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://xzist.org/blog/?p=169</guid>
		<description><![CDATA[The power of printf reveals all. Hmm. It doesn&#8217;t crash though. Weird graphical excitations occur instead. Bugs which cause crashes are the *nice* ones. This is far more insidious.]]></description>
			<content:encoded><![CDATA[<p><img src="http://xzist.org/blog/wp-content/uploads/2009/07/wehaveabug.png" alt="wehaveabug" title="wehaveabug" width="669" height="335" class="alignnone size-full wp-image-168" /></p>
<p>The power of printf reveals all. Hmm.</p>
<p>It doesn&#8217;t crash though. Weird graphical excitations occur instead. Bugs which cause crashes are the *nice* ones. This is far more insidious.</p>
]]></content:encoded>
			<wfw:commentRss>http://xzist.org/blog/2009/07/we-have-a-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping a running average</title>
		<link>http://xzist.org/blog/2009/04/keeping-a-running-average/</link>
		<comments>http://xzist.org/blog/2009/04/keeping-a-running-average/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 21:18:01 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://xzist.org/blog/?p=101</guid>
		<description><![CDATA[I needed to average a lot of large values and was afraid that the normal approach of a+b+c..etc/N would overflow or something. So here&#8217;s a C++ class to keep a running average: class InfiniteRunningAverage { double average; double valueCount; public: InfiniteRunningAverage() { average = 0.0; valueCount = 1; } void Add(double value) { average = [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to average a lot of large values and was afraid that the normal approach of a+b+c..etc/N would overflow or something.</p>
<p>So here&#8217;s a C++ class to keep a running average:</p>
<pre>class InfiniteRunningAverage
{
	double average;
	double valueCount;

public:
	InfiniteRunningAverage()
	{
		average = 0.0;
		valueCount = 1;
	}

	void Add(double value)
	{
		average = average * ((valueCount-1.0)/valueCount) + value * (1.0/valueCount);

		valueCount += 1.0;
	}

	double Get()
	{
		return average;
	}
};</pre>
<p>Hmm. I guess eventually valueCount will get so big that new values will have no effect. So it can&#8217;t really be considered an infinite running average.</p>
]]></content:encoded>
			<wfw:commentRss>http://xzist.org/blog/2009/04/keeping-a-running-average/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An error compiling ODE&#8230;</title>
		<link>http://xzist.org/blog/2009/03/an-error-compiling-ode/</link>
		<comments>http://xzist.org/blog/2009/03/an-error-compiling-ode/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 17:09:38 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://xzist.org/blog/?p=41</guid>
		<description><![CDATA[Hmm, I just got this error after running make: process_begin: CreateProcess(NULL, cc -MMD -D_DEBUG -DdSINGLE -DWIN32 -DODE_DLL -DdSINGLE -I../../include -I../../ode/src -I../../ode/src/joints -I../../OPCODE -I../../GIMPACT/include -I../../ou/include -g -o obj/DebugSingleDLL/ode/fastlsol ve.o -c ../../ode/src/fastlsolve.c, ...) failed. make (e=2): The system cannot find the file specified. make[1]: *** [obj/DebugSingleDLL/ode/fastlsolve.o] Error 2 make: *** [ode] Error 2 After unsuccessfully searching the [...]]]></description>
			<content:encoded><![CDATA[<p>Hmm, I just got this error after running make:</p>
<p><code>process_begin: CreateProcess(NULL, cc -MMD -D_DEBUG -DdSINGLE -DWIN32 -DODE_DLL<br />
-DdSINGLE -I../../include -I../../ode/src -I../../ode/src/joints -I../../OPCODE<br />
-I../../GIMPACT/include -I../../ou/include -g -o obj/DebugSingleDLL/ode/fastlsol<br />
ve.o -c ../../ode/src/fastlsolve.c, ...) failed.<br />
make (e=2): The system cannot find the file specified.<br />
make[1]: *** [obj/DebugSingleDLL/ode/fastlsolve.o] Error 2<br />
make: *** [ode] Error 2</code></p>
<p>After unsuccessfully searching the ODE mailing list archives for &#8220;fastlsolve&#8221;, google <a href="http://ode.org/old_list_archives/2001-November/017177.html">revealed to me</a> that the file which could not be found was actually <i>cc</i> not fastlsolve.c (and so CreateProcess was failing).</p>
<p>Evidently I don&#8217;t have cc on my system. I&#8217;m not even sure what cc is. The C compiler?</p>
<p>Anyway the quick and simple fix is to make a copy of <i>gcc</i> and name it cc. Is that an OK thing to do? Who knows. But it works!</p>
]]></content:encoded>
			<wfw:commentRss>http://xzist.org/blog/2009/03/an-error-compiling-ode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
