<?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 Perilous Adventures of a Software Archaeologist</title>
	<atom:link href="http://chris.iluo.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://chris.iluo.net/blog</link>
	<description>As endured by Chris Pilkington</description>
	<lastBuildDate>Thu, 29 Jul 2010 10:31:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Find Broken Symbolic Links</title>
		<link>http://chris.iluo.net/blog/2010/07/29/find-broken-symbolic-links/</link>
		<comments>http://chris.iluo.net/blog/2010/07/29/find-broken-symbolic-links/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 10:31:23 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=240</guid>
		<description><![CDATA[# Print out broken symbolic links find -L . -type l Note to self: Move this to a useful Linux tips post.]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Print out broken symbolic links</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-L</span> . <span style="color: #660033;">-type</span> l</pre></div></div>

<p>Note to self: Move this to a useful Linux tips post.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2010/07/29/find-broken-symbolic-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>malloc double free/non- aligned pointer being freed set a breakpoint in malloc_error_break to debug</title>
		<link>http://chris.iluo.net/blog/2010/01/10/malloc-double-freenon-aligned-pointer-being-freed-set-a-breakpoint-in-malloc_error_break-to-debug/</link>
		<comments>http://chris.iluo.net/blog/2010/01/10/malloc-double-freenon-aligned-pointer-being-freed-set-a-breakpoint-in-malloc_error_break-to-debug/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 23:00:22 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=227</guid>
		<description><![CDATA[malloc: *** error for object 0x3874a0: double free ***set a breakpoint in malloc_error_break to debug malloc: *** error for object 0x18a138: Non- aligned pointer being freed *** set a breakpoint in malloc_error_break to debug So basically something in your code &#8230; <a href="http://chris.iluo.net/blog/2010/01/10/malloc-double-freenon-aligned-pointer-being-freed-set-a-breakpoint-in-malloc_error_break-to-debug/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre>
malloc: *** error for object 0x3874a0: double free
***set a breakpoint in malloc_error_break to debug

malloc: *** error for object 0x18a138: Non- aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
</pre>
<p>So basically something in your code is screwing around with memory.</p>
<p>Either releasing something that has already been released:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span><span style="color: #000040;">*</span> x <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> x<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> x<span style="color: #008080;">;</span>
<span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> x<span style="color: #008080;">;</span></pre></div></div>

<p>Or releasing something that is not pointing to the start of an allocated block of memory:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span><span style="color: #000040;">*</span> x <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> <span style="color: #0000ff;">int</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
x<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> x<span style="color: #008080;">;</span></pre></div></div>

<p>The error message isn&#8217;t very clear if you have no experience with <a href="http://en.wikipedia.org/wiki/GNU_Debugger">GDB</a>.  GDB is a debugger for your binaries.  It allows you to set break points at the start of a function and any time that function is called your application will pause and allow you to debug in GDB.  We can then get valuable information back by executing commands to get the backtrace, registers state and disassembly.  The advantage of using GDB over <a href="http://en.wikipedia.org/wiki/Xcode">Xcode</a>/<a href="http://en.wikipedia.org/wiki/KDevelop">KDevelop</a> is being able to break into any function, not just functions in your source code.  Anyway, this is how I got the backtrace to find out where in my sourcecode I was making a mistake:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gdb</span>
<span style="color: #c20cb9; font-weight: bold;">file</span> myapplication
<span style="color: #7a0874; font-weight: bold;">break</span> malloc_error_break
run
backtrace</pre></div></div>

<p>Now whenever a double free or non- aligned pointer is freed it will break into gdb and we can type in &#8220;backtrace&#8221; and work out what our code did to trigger this.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2010/01/10/malloc-double-freenon-aligned-pointer-being-freed-set-a-breakpoint-in-malloc_error_break-to-debug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot open /dev/sda1: Device or resource busy</title>
		<link>http://chris.iluo.net/blog/2009/11/16/cannot-open-devsda1-device-or-resource-busy/</link>
		<comments>http://chris.iluo.net/blog/2009/11/16/cannot-open-devsda1-device-or-resource-busy/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 11:23:19 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[grub]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=223</guid>
		<description><![CDATA[After an update (Upgrade?) a while ago I couldn&#8217;t boot into Fedora, it had the text mode bar graph and after getting to 100% it failed with this error message: Cannot open /dev/sda1: Device or resource busy It turned out &#8230; <a href="http://chris.iluo.net/blog/2009/11/16/cannot-open-devsda1-device-or-resource-busy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After an update (Upgrade?) a while ago I couldn&#8217;t boot into Fedora, it had the text mode bar graph and after getting to 100% it failed with this error message:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Cannot open <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1: Device or resource busy</pre></div></div>

<p>It turned out that this was a dmraid problem.  It would appear that something changed when updating and added or enabled dmraid.  So I had to find a way to remove or disable it, the simplest solution I found that worked was disabling it via the arguments to the kernel in GRUB.</p>
<p>Edit menu.lst (Or grub.conf, my menu.lst is a symbolic link to grub.conf)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span>
gedit <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>grub<span style="color: #000000; font-weight: bold;">/</span>menu.lst</pre></div></div>

<p>Find the entry that you are currently booting into and add &#8220;nodmraid&#8221; to the end of the &#8220;kernel&#8221; line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">	kernel <span style="color: #000000; font-weight: bold;">/</span>vmlinuz-2.6.31.6-166.fc12.x86_64 ro <span style="color: #007800;">root</span>=<span style="color: #007800;">UUID</span>=7129c2cc-03c5-4b7a-<span style="color: #000000;">8472</span>-bb9d314446b3  <span style="color: #007800;">LANG</span>=en_US.UTF-<span style="color: #000000;">8</span> <span style="color: #007800;">SYSFONT</span>=latarcyrheb-sun16 <span style="color: #007800;">KEYBOARDTYPE</span>=pc <span style="color: #007800;">KEYTABLE</span>=us rhgb quiet nodmraid</pre></div></div>

<p>I also like to add a timeout and remove hiding of the menu (This is in the general entry at the top of the file):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">timeout</span>=<span style="color: #000000;">10</span>
<span style="color: #666666; font-style: italic;">#hiddenmenu</span></pre></div></div>

<p>My final menu.lst/grub.conf file looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">default</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">timeout</span>=<span style="color: #000000;">10</span>
<span style="color: #007800;">splashimage</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>hd0,<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>grub<span style="color: #000000; font-weight: bold;">/</span>splash.xpm.gz
<span style="color: #666666; font-style: italic;">#hiddenmenu</span>
title Fedora <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.6.31.6-166.fc12.x86_64<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	root <span style="color: #7a0874; font-weight: bold;">&#40;</span>hd0,<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	kernel <span style="color: #000000; font-weight: bold;">/</span>vmlinuz-2.6.31.6-166.fc12.x86_64 ro <span style="color: #007800;">root</span>=<span style="color: #007800;">UUID</span>=7129c2cc-03c5-4b7a-<span style="color: #000000;">8472</span>-bb9d314446b3  <span style="color: #007800;">LANG</span>=en_US.UTF-<span style="color: #000000;">8</span> <span style="color: #007800;">SYSFONT</span>=latarcyrheb-sun16 <span style="color: #007800;">KEYBOARDTYPE</span>=pc <span style="color: #007800;">KEYTABLE</span>=us rhgb quiet
	initrd <span style="color: #000000; font-weight: bold;">/</span>initramfs-2.6.31.6-166.fc12.x86_64.img</pre></div></div>

<p>Why Chris, your grub.conf is so puny, only one entry in it.  Leave me alone, I only just reinstalled.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/11/16/cannot-open-devsda1-device-or-resource-busy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When Good Customers Go Bad</title>
		<link>http://chris.iluo.net/blog/2009/09/26/when-good-customers-go-bad/</link>
		<comments>http://chris.iluo.net/blog/2009/09/26/when-good-customers-go-bad/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 22:36:47 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[oh noes]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=218</guid>
		<description><![CDATA[class Customer; class CustomerEx; // Added 20.03.2006 class CustomerEx2; // Added 05.10.2006 class CustomerEx2B; // Added 13.07.2008]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> Customer<span style="color: #008080;">;</span>
<span style="color: #0000ff;">class</span> CustomerEx<span style="color: #008080;">;</span> <span style="color: #666666;">// Added 20.03.2006</span>
<span style="color: #0000ff;">class</span> CustomerEx2<span style="color: #008080;">;</span> <span style="color: #666666;">// Added 05.10.2006</span>
<span style="color: #0000ff;">class</span> CustomerEx2B<span style="color: #008080;">;</span> <span style="color: #666666;">// Added 13.07.2008</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/09/26/when-good-customers-go-bad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Find and Remove Folders Recursively in Linux/Unix Because I Always Forget This</title>
		<link>http://chris.iluo.net/blog/2009/09/26/how-to-find-and-remove-folders-in-linuxunix-because-i-always-forget-this/</link>
		<comments>http://chris.iluo.net/blog/2009/09/26/how-to-find-and-remove-folders-in-linuxunix-because-i-always-forget-this/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 22:33:04 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=216</guid>
		<description><![CDATA[# Recursively search for folders called .svn and delete them (Even if not empty) find . -name .svn -type d -print &#124; xargs rm -rf &#160; # Recursively search for files called *~ (gedit creates these for temporarily saving to) &#8230; <a href="http://chris.iluo.net/blog/2009/09/26/how-to-find-and-remove-folders-in-linuxunix-because-i-always-forget-this/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Recursively search for folders called .svn and delete them (Even if not empty)</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> .svn <span style="color: #660033;">-type</span> d <span style="color: #660033;">-print</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Recursively search for files called *~ (gedit creates these for temporarily saving to) and delete them</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>~ <span style="color: #660033;">-print</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Recursively search for files called *.h or *.cpp and print them</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.h'</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.cpp'</span> <span style="color: #660033;">-print</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/09/26/how-to-find-and-remove-folders-in-linuxunix-because-i-always-forget-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blender Export OBJ Python Script</title>
		<link>http://chris.iluo.net/blog/2009/09/12/blender-export-obj-python-script/</link>
		<comments>http://chris.iluo.net/blog/2009/09/12/blender-export-obj-python-script/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 04:50:42 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gamedev]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[obj]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=208</guid>
		<description><![CDATA[First of all I&#8217;d like to state that I&#8217;m definitely a Blender n00b and I have never touched Python in my life. In my game engine I basically have this sort of layout: sphere/ sphere.obj sphere.mat sphere.png The .obj points &#8230; <a href="http://chris.iluo.net/blog/2009/09/12/blender-export-obj-python-script/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>First of all I&#8217;d like to state that I&#8217;m definitely a <a href="http://www.blender.org/">Blender</a> n00b and I have never touched <a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29">Python</a> in my life.  </p>
<div id="attachment_212" class="wp-caption alignleft" style="width: 310px"><a href="http://chris.iluo.net/blog/wp-content/uploads/2009/09/sphere.png"><img src="http://chris.iluo.net/blog/wp-content/uploads/2009/09/sphere-300x225.png" alt="Baby steps, textured sphere loaded from an obj file" title="Sphere" width="300" height="225" class="size-medium wp-image-212" /></a><p class="wp-caption-text">Baby steps, textured sphere loaded from an obj file</p></div>
<p>In my game engine I basically have this sort of layout:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sphere<span style="color: #000000; font-weight: bold;">/</span>
sphere.obj
sphere.mat
sphere.png</pre></div></div>

<p>The .obj points to the .mat file which points to the .png file.  So in Blender I would set the material name to &#8220;sphere&#8221; and ideally in the .obj file it would have a line like this, &#8220;usemtl sphere&#8221;, I would then get the sphere part and append &#8220;.mat&#8221; and load the material.  I&#8217;m not sure if this is standard practice for Blender export scripts, but when exporting to the <a href="http://en.wikipedia.org/wiki/Obj">obj</a> file <a href="http://www.royriggs.com/obj.html">format</a>, Blender adds the texture name to the material like so, &#8220;usemtl sphere_sphere.png&#8221;, not cool.  Anyway I thought, hey, the export script is written in Python, I wonder if I can fix this?</p>
<p>1) Locate the script.  I read somewhere on the Blender site that scripts are in &#8220;/usr/share/blender/scripts/&#8221;.  &#8220;export_obj.py&#8221; is there, along side &#8220;export_obj.pyc&#8221; and &#8220;export_obj.pyo&#8221;.<br />
2) Edit the script.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gedit <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>blender<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>export_obj.py</pre></div></div>

<p>3) <a href="https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts/export_obj.py">The script</a> is pretty well documented.  I knew that I should search for &#8220;usemtl&#8221; as that is the only constant part of the string (Apart from &#8220;_&#8221; which is much harder to search for).  There are two in the file and we want the second one:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">mat_data= MTL_DICT.<span style="color: black;">get</span><span style="color: black;">&#40;</span>key<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> mat_data:
		<span style="color: #808080; font-style: italic;"># First add to global dict so we can export to mtl</span>
		<span style="color: #808080; font-style: italic;"># Then write mtl</span>
&nbsp;
		<span style="color: #808080; font-style: italic;"># Make a new names from the mat and image name,</span>
		<span style="color: #808080; font-style: italic;"># converting any spaces to underscores with fixName.</span>
&nbsp;
		<span style="color: #808080; font-style: italic;"># If none image dont bother adding it to the name</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> key<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == <span style="color: #008000;">None</span>:
			mat_data = MTL_DICT<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span> = <span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s'</span><span style="color: #66cc66;">%</span>fixName<span style="color: black;">&#40;</span>key<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, materialItems<span style="color: black;">&#91;</span>f_mat<span style="color: black;">&#93;</span>, f_image
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			mat_data = MTL_DICT<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span> = <span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s_%s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>fixName<span style="color: black;">&#40;</span>key<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>, fixName<span style="color: black;">&#40;</span>key<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, materialItems<span style="color: black;">&#91;</span>f_mat<span style="color: black;">&#93;</span>, f_image
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">if</span> EXPORT_GROUP_BY_MAT:
		<span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'g %s_%s_%s<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>fixName<span style="color: black;">&#40;</span>ob.<span style="color: black;">name</span><span style="color: black;">&#41;</span>, fixName<span style="color: black;">&#40;</span>ob.<span style="color: black;">getData</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, mat_data<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;"># can be mat_image or (null)</span>
&nbsp;
	<span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'usemtl %s<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> mat_data<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;"># can be mat_image or (null)</span></pre></div></div>

<p>mat_data is a dictionary that is filled out and then written the file with &#8220;usemtl&#8221;.  I replaced the offending line:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">mat_data = MTL_DICT<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span> = <span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s_%s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>fixName<span style="color: black;">&#40;</span>key<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>, fixName<span style="color: black;">&#40;</span>key<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, materialItems<span style="color: black;">&#91;</span>f_mat<span style="color: black;">&#93;</span>, f_image</pre></div></div>

<p>with this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">mat_data = MTL_DICT<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span> = <span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s'</span><span style="color: #66cc66;">%</span>fixName<span style="color: black;">&#40;</span>key<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, materialItems<span style="color: black;">&#91;</span>f_mat<span style="color: black;">&#93;</span>, f_image</pre></div></div>

<p>And then I realised that it was exactly the same as the line from the &#8220;if key[1] == None:&#8221; so you could probably remove the branch etc. if you want, I didn&#8217;t bother.</p>
<p>If you are exporting groups by material you may also need to edit the &#8220;if EXPORT_GROUP_BY_MAT:&#8221; branch also, again I didn&#8217;t bother.  Anyway, save and you&#8217;re good to go.</p>
<p>4) I was worried that I would have to compile into bytecode or something for Blender to be able to use this, nope, either restart Blender or <a href="http://wiki.blender.org/index.php/Extensions:Py/Scripts/Manual#Refreshing_the_List_of_Available_Scripts">hit &#8220;Update Menu&#8221;</a>.  Actually as it is an export script, I&#8217;m not sure you even need to do that, it probably gets reloaded when you <a href="http://wiki.blender.org/index.php/Extensions:Py/Scripts/Manual/Export/wavefront_obj">hit &#8220;File > Export > Wavefront (.obj)&#8221;</a>?</p>
<p>This is the entirety of my Python knowledge, oh, I also know that whitespace is important or something, woo.</p>
<p>PS. I&#8217;m loving <a href="http://git-scm.com/">git</a>, I can&#8217;t believe I didn&#8217;t switch earlier!</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/09/12/blender-export-obj-python-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Love the Idea of a New Smart Phone</title>
		<link>http://chris.iluo.net/blog/2009/08/30/i-love-the-idea-of-a-new-smart-phone/</link>
		<comments>http://chris.iluo.net/blog/2009/08/30/i-love-the-idea-of-a-new-smart-phone/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 10:04:31 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[nokia n900]]></category>
		<category><![CDATA[smartphone]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=190</guid>
		<description><![CDATA[The list of awesome phones: HTC Phones OpenMoko Palm Pre However, a new hotness has just been born. The Nokia n900. 32 GB internal storage Expandable to up to 48 GB with external microSD card 3.5G mobile network Quadband GSM &#8230; <a href="http://chris.iluo.net/blog/2009/08/30/i-love-the-idea-of-a-new-smart-phone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The list of awesome phones:<br />
<a href="http://www.htc.com/">HTC Phones</a><br />
<a href="http://www.openmoko.com/">OpenMoko</a><br />
<a href="http://www.palm.com/us/products/phones/pre/">Palm Pre</a></p>
<p>However, a new hotness has just been born.</p>
<p>The <a href="http://maemo.nokia.com/n900/">Nokia n900</a>.</p>
<p>32 GB internal storage<br />
Expandable to up to 48 GB with external microSD card<br />
3.5G mobile network<br />
Quadband GSM with GPRS and EDGE<br />
Data transfers over a cellular network 10/2Mbps<br />
Data transfers over Wi-Fi 54Mbps</p>
<p>Flash 9.4 support (In your face iPhone users, Nokia loves me)</p>
<p>5-megapixel (2584 × 1938 resolution) digital camera (<a href="http://en.wikipedia.org/wiki/IPhone#Camera_and_photos">iPhone is up to 3.2-megapixel</a>)<br />
800 × 480 resolution video recording<br />
Dual LED flash</p>
<p>800 × 480 resolution screen<br />
Tactile and onscreen QWERTY keyboards (Yes, none of this onscreen keyboard rubbish)<br />
Removable battery (That probably won&#8217;t <a href="http://www.crunchgear.com/2009/08/12/yet-another-exploding-iphone/">explode</a>)</p>
<p>Assisted-GPS receiver<br />
Ovi Maps pre-installed</p>
<p>TV out (PAL/NTSC) with Nokia Video Connectivity Cable (CA-75U, included in box) or WLAN/UPnP</p>
<p>Wide aspect ratio 16:9 (WVGA)<br />
Video recording file format: .mp4; codec: MPEG-4<br />
Video recording at up to 848 × 480 pixels (WVGA) and up to 25fps<br />
Video playback file formats: .mp4, .avi, .wmv, .3gp; codecs: H.264, MPEG-4, Xvid, WMV, H.263</p>
<p>Music playback file formats: .wav, .mp3, .AAC, .eAAC, .wma, .m4a</p>
<p>The important part:<br />
Development in <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29">C</a> and <a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29">Python</a> are supported, using <a href="http://www.gtk.org/">GTK</a>.<br />
Unfortunately it looks like <a href="http://en.wikipedia.org/wiki/C%2B%2B">C++</a> is not supported so anyone wanting to do any <a href="http://en.wikipedia.org/wiki/Object-oriented_programming">OOP</a> will have to do it in Python.<br />
That is great that Nokia are supporting open standards, releasing a mobile phone running <a href="http://en.wikipedia.org/wiki/Linux">Linux</a>.  It would be nice if they supported C++ too, but that is just my personal preference, and it may come in the future, I know all the C++ jazz is quite complex and definitely non-trivial.</p>
<p>I&#8217;d still rather use Python than C.  I certainly hope that Windows Mobile dies and the highly overrated iPhone becomes less popular, not completely die, just put in its place.  I would love to see the world embrace <a href="http://en.wikipedia.org/wiki/Open_standard">open standards</a>, <a href="http://en.wikipedia.org/wiki/Open_source">open source software</a> and a rise in <a href="http://en.wikipedia.org/wiki/Digital_restrictions_management#.22DRM-Free.22"><acronym title="Digital Restrictions Management">DRM free</acronym></a>, happy, feel good devices, gain popularity and eventually dominate the market and warm people&#8217;s hearts.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/08/30/i-love-the-idea-of-a-new-smart-phone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving from SVN to GIT</title>
		<link>http://chris.iluo.net/blog/2009/08/28/moving-from-svn-to-git/</link>
		<comments>http://chris.iluo.net/blog/2009/08/28/moving-from-svn-to-git/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 22:00:21 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=171</guid>
		<description><![CDATA[So I have a few projects on SourceForge, but they&#8217;re all hosted via SVN. With all this distributed version control going on I thought I would like to get in on the action. I thought about moving to github, but &#8230; <a href="http://chris.iluo.net/blog/2009/08/28/moving-from-svn-to-git/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So I have a <a href="http://sourceforge.net/users/pilkch">few projects</a> on <a href="http://www.sourceforge.net/">SourceForge</a>, but they&#8217;re all hosted via <a href="http://en.wikipedia.org/wiki/Subversion_%28software%29">SVN</a>.  With <a href="http://en.wikipedia.org/wiki/Mercurial_%28software%29">all</a> <a href="http://en.wikipedia.org/wiki/Bazaar_%28software%29">this</a> <a href="http://en.wikipedia.org/wiki/Git_%28software%29">distributed</a> version control going on I thought I would like to get in on the action.  I thought about moving to github, but what happens in 5 or 10 years when I want to move on to another <a href="http://en.wikipedia.org/wiki/Comparison_of_revision_control_software">revision control software</a>?  The name has a limited life expectancy.  Anyway so I wanted to switch so I researched alot, <a href="http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/">this</a> is the best information I found and this blog entry is basically a rehash specific to SourceForge (Because I didn&#8217;t find any good SourceForge specific information).</p>
<p><strong>Note: For this tutorial you will want to change all occurrences of USERNAME to your user name for example &#8220;pilkch&#8221;, PROJECTNAME to your project name for example &#8220;breathe&#8221; and YOURFULLNAME to your full name for example &#8220;Chris Pilkington&#8221;.</strong></p>
<p>First of all we need to download git and git-svn:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span>
yum <span style="color: #c20cb9; font-weight: bold;">install</span> git git-svn</pre></div></div>

<p>Now we are going to create our repo directory for holding our repositories:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> repo</pre></div></div>

<p>Create a users.txt file to map our subversion users to git users:</p>
<p>users.txt</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">USERNAME = YOURFULLNAME &lt;USERNAME@PROJECTNAME.git.sourceforge.net&gt;</pre></div></div>

<p>As the other article says, we basically check out a svn directory as a git repository:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> repo
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> PROJECTNAME_from_svn
<span style="color: #7a0874; font-weight: bold;">cd</span> PROJECTNAME_from_svn
git <span style="color: #c20cb9; font-weight: bold;">svn</span> init http:<span style="color: #000000; font-weight: bold;">//</span>PROJECTNAME.svn.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>svnroot<span style="color: #000000; font-weight: bold;">/</span>PROJECTNAME <span style="color: #660033;">--no-metadata</span>
git config svn.authorsfile ..<span style="color: #000000; font-weight: bold;">/</span>users.txt
git <span style="color: #c20cb9; font-weight: bold;">svn</span> fetch</pre></div></div>

<p>Check that worked (Just read the last few changes to make sure svn history is present, you can hit spacebar to scroll back a page of history or two just to make sure):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git log</pre></div></div>

<p>From now on we can use git commands, first of all want to create a copy of the git-svn repository:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..
git clone PROJECTNAME_from_svn PROJECTNAME</pre></div></div>

<p>PROJECTNAME/ now contains our &#8220;clean&#8221; repository and PROJECTNAME_from_svn can be deleted if you like.  We now just need to add and push our local repository to the remote location:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> PROJECTNAME
git config user.name <span style="color: #ff0000;">&quot;YOURFULLNAME&quot;</span>
git config user.email <span style="color: #ff0000;">&quot;USERNAME@users.sourceforge.net&quot;</span>
git remote <span style="color: #c20cb9; font-weight: bold;">rm</span> origin <span style="color: #666666; font-style: italic;"># This may not be necessary for you</span>
git remote add origin <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>USERNAME<span style="color: #000000; font-weight: bold;">@</span>PROJECTNAME.git.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>gitroot<span style="color: #000000; font-weight: bold;">/</span>PROJECTNAME<span style="color: #000000; font-weight: bold;">/</span>PROJECTNAME
git config branch.master.remote origin
git config branch.master.merge refs<span style="color: #000000; font-weight: bold;">/</span>heads<span style="color: #000000; font-weight: bold;">/</span>master
git push origin master</pre></div></div>

<p>Now to check that this is working you can browse to the git page of your SourceForge project and there should be data in your repository.  And we can clone our repository back again to check that everything is working.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git clone <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>USERNAME<span style="color: #000000; font-weight: bold;">@</span>PROJECTNAME.git.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>gitroot<span style="color: #000000; font-weight: bold;">/</span>PROJECTNAME<span style="color: #000000; font-weight: bold;">/</span>PROJECTNAME</pre></div></div>

<p>You may also want to ignore certain types of files, place a file called .gitignore in the root directory of your project and fill it with the patterns you want ignored:</p>
<p>.gitignore</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">.DS_Store
.svn
._*
~$*
.*.swp
Thumbs.db</pre></div></div>

<p>Now when we want to update we can do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git commit <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;This is my commit message.&quot;</span> <span style="color: #666666; font-style: italic;"># All changes to the local repository need to be committed before we try merging new changes</span>
git pull <span style="color: #666666; font-style: italic;"># Grab any changes from the main repository</span></pre></div></div>

<p>Committing is slightly different:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git add .gitignore <span style="color: #666666; font-style: italic;"># For example we might want to add our new .gitignore file</span>
git commit <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;This is my commit message.&quot;</span> <span style="color: #666666; font-style: italic;"># Note: Your commit has now only been staged, it is not in the main repository yet</span>
git push <span style="color: #666666; font-style: italic;"># Now it is pushed into the main repository</span></pre></div></div>

<p>That last step is to remove your svn repository which for SourceForge is as simple as unchecking a checkbox on the Admin->Features page.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/08/28/moving-from-svn-to-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symbols/Characters Returned by ls -l</title>
		<link>http://chris.iluo.net/blog/2009/08/27/symbolscharacters-returned-by-ls-l/</link>
		<comments>http://chris.iluo.net/blog/2009/08/27/symbolscharacters-returned-by-ls-l/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 23:45:12 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=176</guid>
		<description><![CDATA[$ ls -l total 24 drwxrwxr-x ... thisisadirectory -rw-rw-r-- ... thisisafile lrwxrwxrwx. ... thisisalink -&#62; /media/data We know what the rwx fields are but what about d, &#8211; and l? Ok, those are pretty obvious too, here is a list &#8230; <a href="http://chris.iluo.net/blog/2009/08/27/symbolscharacters-returned-by-ls-l/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span>
total <span style="color: #000000;">24</span>
drwxrwxr-x   ...   thisisadirectory
<span style="color: #660033;">-rw-rw-r--</span>   ...   thisisafile
lrwxrwxrwx.  ...   thisisalink -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>data</pre></div></div>

<p>We <a href="http://www.freeos.com/articles/3127/">know what the rwx fields are</a> but what about d, &#8211; and l?  Ok, those are pretty obvious too, <a href="http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html">here</a> is a list of the more obscure ones because I always forget.</p>
<p><strong>d</strong>     Directory.<br />
<strong>l</strong>     Symbolic link.<br />
<strong>-</strong>     Regular file.</p>
<p><strong>b</strong>     Block buffered device special file.<br />
<strong>c</strong>     Character unbuffered device special file.<br />
<strong>s</strong>     Socket link.<br />
<strong>p</strong>     FIFO pipe.<br />
<strong>.</strong> indicates a file with an SELinux security context, but no other alternate access method.</p>
<p><strong>s</strong>    setuid &#8211; This is only found in the execute field.<br />
If there is a &#8220;-&#8221; in a particular location, there is no permission. This may be found in any field whether read, write, or execute field.</p>
<p>The file permissions bits include an execute permission bit for file owner, group and other. When the execute bit for the owner is set to &#8220;s&#8221; the set user ID bit is set.<br />
This causes any persons or processes that run the file to have access to system resources as though they are the owner of the file. When the execute bit for the group is set to &#8220;s&#8221;,<br />
the set group ID bit is set and the user running the program is given access based on access permission for the group the file belongs to.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/08/27/symbolscharacters-returned-by-ls-l/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>libxdgmm</title>
		<link>http://chris.iluo.net/blog/2009/07/22/libxdgmm/</link>
		<comments>http://chris.iluo.net/blog/2009/07/22/libxdgmm/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 22:46:05 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[libxdgmm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xdg]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=150</guid>
		<description><![CDATA[I think the Portland Project from freedesktop.org, is a great idea and everyone should be supporting it in their applications. I&#8217;ve just created a very small C++ wrapper (libxdgmm) for accessing XDG more easily. To use it, you need libxdgmm.h &#8230; <a href="http://chris.iluo.net/blog/2009/07/22/libxdgmm/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I think the <a href="http://en.wikipedia.org/wiki/Portland_Project">Portland Project</a> from <a href="http://www.freedesktop.org/">freedesktop.org</a>, is a great idea and<br />
everyone should be <a href="http://ploum.frimouvy.org/?207-modify-your-application-to-use-xdg-folders">supporting it in their applications</a>.</p>
<p>I&#8217;ve just created a very small C++ wrapper (libxdgmm) for accessing <a href="http://portland.freedesktop.org/wiki/">XDG</a> more easily.  To use it, you need <a href="http://breathe.git.sourceforge.net/git/gitweb.cgi?p=breathe/breathe;a=blob;f=include/libxdgmm/libxdgmm.h;hb=HEAD">libxdgmm.h</a> and <a href="http://breathe.git.sourceforge.net/git/gitweb.cgi?p=breathe/breathe;a=blob;f=src/libxdgmm/libxdgmm.cpp;hb=HEAD">libxdgmm.cpp</a>.  Just add these to your project and then use them like so:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;libxdgmm/libxdg.h&gt;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span><span style="color: #000040;">**</span> argv<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>xdg<span style="color: #008080;">::</span><span style="color: #007788;">IsInstalled</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;XDG is not installed&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">else</span> <span style="color: #008000;">&#123;</span>
    std<span style="color: #008080;">::</span><span style="color: #007788;">string</span> data<span style="color: #008080;">;</span>
    xdg<span style="color: #008080;">::</span><span style="color: #007788;">GetDataHome</span><span style="color: #008000;">&#40;</span>data<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;data=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #000080;">&lt;&lt;</span>data<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
&nbsp;
    std<span style="color: #008080;">::</span><span style="color: #007788;">string</span> config<span style="color: #008080;">;</span>
    xdg<span style="color: #008080;">::</span><span style="color: #007788;">GetConfigHome</span><span style="color: #008000;">&#40;</span>config<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;config=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #000080;">&lt;&lt;</span>config<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Obviously these have to exist to work.  You can translate the error code returned by calling xdg::GetOpenErrorString(int result);</span>
    xdg<span style="color: #008080;">::</span><span style="color: #007788;">OpenFile</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;/home/chris/dev/cMd3Loader.cpp&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    xdg<span style="color: #008080;">::</span><span style="color: #007788;">OpenFolder</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;/home/chris/&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    xdg<span style="color: #008080;">::</span><span style="color: #007788;">OpenURL</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;http://chris.iluo.net&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">EXIT_SUCCESS</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>I still have to wrap some of the other functionality, such as XDG_DESKTOP_DIR, XDG_DOCUMENTS_DIR, XDG_MUSIC_DIR, desktop-file-utils, xdg-desktop-menu and xdg-desktop-icon etc.  I will wrap these as I need them (Or at special request).  I don&#8217;t think I will be supporting xdg-screensaver or xdg-mime as I don&#8217;t have a use for them right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/07/22/libxdgmm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>C++0x compiling with gcc</title>
		<link>http://chris.iluo.net/blog/2009/07/20/c0x-compiling-with-gcc/</link>
		<comments>http://chris.iluo.net/blog/2009/07/20/c0x-compiling-with-gcc/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 23:30:55 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++0x]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=152</guid>
		<description><![CDATA[Gcc has some early support for C++0x. You can enable it with -std=c++0x (Note: You can already use Boost without enabling this flag). Enabling this flag broke boost::filesystem for me, but this has already been reported and fixed: boost/filesystem/operations.hpp 661 &#8230; <a href="http://chris.iluo.net/blog/2009/07/20/c0x-compiling-with-gcc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Gcc has some early support for C++0x.  You can enable it with -std=c++0x (Note: You can already use <a href="http://www.boost.org/">Boost</a> without enabling this flag).  Enabling this flag broke boost::filesystem for me, but this has already been <a href="https://svn.boost.org/trac/boost/ticket/3008">reported</a> and <a href="https://svn.boost.org/trac/boost/attachment/ticket/3008/fs_gcc44.patch">fixed</a>:</p>
<p>boost/filesystem/operations.hpp</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000dd;">661</span>	<span style="color: #0000dd;">661</span>	    <span style="color: #0000ff;">inline</span> <span style="color: #0000ff;">bool</span> is_empty<span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">const</span> path <span style="color: #000040;">&amp;</span> ph <span style="color: #008000;">&#41;</span> 
<span style="color: #0000dd;">662</span>	 	<span style="color: #000040;">-</span>      <span style="color: #008000;">&#123;</span> <span style="color: #0000ff;">return</span> is_empty<span style="color: #000080;">&lt;</span>path<span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span> ph <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span> 
 	<span style="color: #0000dd;">662</span>	<span style="color: #000040;">+</span>      <span style="color: #008000;">&#123;</span> <span style="color: #0000ff;">return</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">filesystem</span><span style="color: #008080;">::</span><span style="color: #007788;">is_empty</span><span style="color: #000080;">&lt;</span>path<span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span> ph <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span> 
<span style="color: #0000dd;">663</span>	<span style="color: #0000dd;">663</span>	    <span style="color: #0000ff;">inline</span> <span style="color: #0000ff;">bool</span> is_empty<span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">const</span> wpath <span style="color: #000040;">&amp;</span> ph <span style="color: #008000;">&#41;</span> 
<span style="color: #0000dd;">664</span>	 	<span style="color: #000040;">-</span>      <span style="color: #008000;">&#123;</span> <span style="color: #0000ff;">return</span> is_empty<span style="color: #000080;">&lt;</span>wpath<span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span> ph <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span> 
 	<span style="color: #0000dd;">664</span>	<span style="color: #000040;">+</span>      <span style="color: #008000;">&#123;</span> <span style="color: #0000ff;">return</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">filesystem</span><span style="color: #008080;">::</span><span style="color: #007788;">is_empty</span><span style="color: #000080;">&lt;</span>wpath<span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span> ph <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span></pre></div></div>

<p>The full patch is much longer, but this seemed to be all I needed to get it to work (Note: You will need to <em>su</em> and then <em>gedit /usr/include/boost/filesystem/operations.hpp</em>).</p>
<p>Anyway, you will want to test it out:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">enum</span> A
<span style="color: #008000;">&#123;</span>
  A_1,
  A_2
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">enum</span> B
<span style="color: #008000;">&#123;</span>
  B_1,
  B_2
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> Test<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  B b <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
&nbsp;
  b <span style="color: #000080;">=</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
  b <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
  b <span style="color: #000080;">=</span> A_1<span style="color: #008080;">;</span>
  b <span style="color: #000080;">=</span> A<span style="color: #008080;">::</span><span style="color: #007788;">A_1</span><span style="color: #008080;">;</span>
  b <span style="color: #000080;">=</span> B_1<span style="color: #008080;">;</span>
  b <span style="color: #000080;">=</span> B<span style="color: #008080;">::</span><span style="color: #007788;">B_1</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The only lines of Test that compile are &#8220;b = B_1;&#8221; and &#8220;b = B::B_1;&#8221;.  Under C++98/C++03 this would 100% compile, which could easily create bugs where the code compiles but may not be what is intended.  We can also get slightly tighter restrictions again, by defining &#8220;enum B&#8221; as &#8220;enum class B&#8221;.  This restricts the correct lines of Test to &#8220;b = B::B_1&#8243;, meaning the enum must be fully qualified which should lead to less ambiguous code.  In a real situation you will also want to actually initialise b to a decent value initially as well: &#8220;B b = B::B_1&#8243; for example.</p>
<p>Anyway, this is a pretty trivial example, just a tidy up of the language really, you will want to <a href="http://gcc.gnu.org/projects/cxx0x.html">delve deeper</a>.  Variadic templates, Initializer lists, Lambda expressions and closures, New character types, Unicode string literals, Raw string literals and Universal character name literals look good.  Extern templates, Inheriting constructors, nullptr, __func__, C99 preprocessor, long long, Extended integral types can&#8217;t get here soon enough.  </p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/07/20/c0x-compiling-with-gcc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AHGotoPage Doesn&#8217;t Work Argh!</title>
		<link>http://chris.iluo.net/blog/2009/06/04/ahgotopage-doesnt-work-argh/</link>
		<comments>http://chris.iluo.net/blog/2009/06/04/ahgotopage-doesnt-work-argh/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 13:14:28 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[carbon]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/2009/06/04/ahgotopage-doesnt-work-argh/</guid>
		<description><![CDATA[It looks like AHGotoPage is broken with Mac OS X 10.5.7 and later (It was also broken on 10.3.9 and earlier). Probably the easiest way around this for the moment is to open your help documentation in a web browser &#8230; <a href="http://chris.iluo.net/blog/2009/06/04/ahgotopage-doesnt-work-argh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It looks like <a href="http://developer.apple.com/documentation/Carbon/Reference/Apple_Help/Reference/reference.html#//apple_ref/doc/uid/TP30000169-CH1g-F16335">AHGotoPage</a> is broken with Mac OS X 10.5.7 and later (It was also broken on 10.3.9 and earlier).  Probably the easiest way around this for the moment is to open your help documentation in a web browser using <a href="http://developer.apple.com/documentation/Carbon/Reference/LaunchServicesReference/Reference/reference.html#//apple_ref/c/func/LSOpenCFURLRef">LSOpenCFURLRef</a> instead.  Hope this helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/06/04/ahgotopage-doesnt-work-argh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgraded Linux Kernel not recognising ext3 partitions and the solution</title>
		<link>http://chris.iluo.net/blog/2009/06/03/upgraded-linux-kernel-not-recognising-ext3-partitions-and-the-solution/</link>
		<comments>http://chris.iluo.net/blog/2009/06/03/upgraded-linux-kernel-not-recognising-ext3-partitions-and-the-solution/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 13:31:14 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[oh noes]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=83</guid>
		<description><![CDATA[Unable to access resume device &#40;/dev/dm-1&#41; mount: error mounting /dev/root on /sysroot as ext3: No such file or directory Being a Linux noob, I found this solution Create mkinitrd.new chmod +x mkinitrd.new su cd /boot sudo ./mkinitrd.new -f initrd-2.6.27.24-170.2.68.fc10.x86_64.img 2.6.27.24-170.2.68.fc10.x86_64]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Unable to access resume device <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>dm-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #c20cb9; font-weight: bold;">mount</span>: error mounting <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>root on <span style="color: #000000; font-weight: bold;">/</span>sysroot <span style="color: #c20cb9; font-weight: bold;">as</span> ext3: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory</pre></div></div>

<p>Being a Linux noob, I found <a href="http://forums.fedoraforum.org/showthread.php?t=216396">this solution</a></p>
<p>Create <a href="https://bugzilla.redhat.com/attachment.cgi?id=330620">mkinitrd.new</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x mkinitrd.new
<span style="color: #c20cb9; font-weight: bold;">su</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>boot
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>mkinitrd.new <span style="color: #660033;">-f</span> initrd-2.6.27.24-170.2.68.fc10.x86_64.img 2.6.27.24-170.2.68.fc10.x86_64</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/06/03/upgraded-linux-kernel-not-recognising-ext3-partitions-and-the-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Error: glXCreateContext failed&#8221; After Updating Video Drivers</title>
		<link>http://chris.iluo.net/blog/2009/04/09/error-glxcreatecontext-failed-after-updating-video-drivers/</link>
		<comments>http://chris.iluo.net/blog/2009/04/09/error-glxcreatecontext-failed-after-updating-video-drivers/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 10:18:51 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/2009/04/09/error-glxcreatecontext-failed-after-updating-video-drivers/</guid>
		<description><![CDATA[After updating video drivers I couldn&#8217;t run 3d applications, for example glxinfo: Error: glXCreateContext failed The following needs to be present in the xorg.conf file: Section "Files" ModulePath "/usr/lib64/xorg/modules/extensions/nvidia" ModulePath "/usr/lib64/xorg/modules" EndSection]]></description>
			<content:encoded><![CDATA[<p>After updating video drivers I couldn&#8217;t run 3d applications, for example glxinfo:</p>
<p><cite>Error: glXCreateContext failed</cite></p>
<p>The following needs to be present in the xorg.conf file:</p>
<p><code>Section "Files"<br />
    ModulePath      "/usr/lib64/xorg/modules/extensions/nvidia"<br />
    ModulePath      "/usr/lib64/xorg/modules"<br />
EndSection</code></p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/04/09/error-glxcreatecontext-failed-after-updating-video-drivers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yearly Update :)</title>
		<link>http://chris.iluo.net/blog/2009/02/25/yearly-update/</link>
		<comments>http://chris.iluo.net/blog/2009/02/25/yearly-update/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 22:17:01 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[gamedev]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=121</guid>
		<description><![CDATA[It&#8217;s been a while, I have like 20 draft entries in WordPress ranging from 1 paragraph comments up to 10 paragraph full on entries that still need that final once over and edit before going live. Actually it might be &#8230; <a href="http://chris.iluo.net/blog/2009/02/25/yearly-update/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_78" class="wp-caption alignright" style="width: 151px"><a href="http://chris.iluo.net/blog/wp-content/uploads/2009/02/sudoku090225.png"><img src="http://chris.iluo.net/blog/wp-content/uploads/2009/02/sudoku090225.png" alt="Sudoku Work in Progress" title="sudoku090225" width="141" height="111" class="size-full wp-image-78" /></a><p class="wp-caption-text">Skysytem background, testing wireframe grid, TombRaider MD3 model, testing material boxes, particle systems, frames per second messages, pegs, shocks, all the necessary elements of a Sudoku game.</p></div>
<p>It&#8217;s been a while, I have like 20 draft entries in <a href="http://www.wordpress.org/">WordPress</a> ranging from 1 paragraph comments up to 10 paragraph full on entries that still need that final once over and edit before going live.  Actually it might be cool if there was (There probably is) a plugin so that people could optionally go to a page on my blog where they can see everything that hasn&#8217;t been published yet, like tagged with &#8220;draft&#8221; or something and comment on which ones I should flesh out and which ones I should ditch before they are even finished.  </p>
<p>Anyway, so I have been working (Getting side tracked while working on) my <a href="http://en.wikipedia.org/wiki/Sudoku">Sudoku</a> game.  </p>
<p>Basically in Sudoku mode you get to select a number from the &#8220;palette&#8221; at the top and then click on all the places you want it on the board.  The solver I have coded up can solve about 80% of Sudoku boards with &#8220;human solvable&#8221; methods and the remaining 20% can be solved with a combination of human solvable and then resorting to brute force for anything it can&#8217;t find.  A valid board should not need brute forcing which means that I need to implement more rules for my human solving methods first.  I should be doing something like this:</p>
<p><code>if (solve_human_methods()) ... solved<br />
else ... this board is invalid as it could not possibly be solved by a human without resorting to brute force</code></p>
<p>However I haven&#8217;t implemented all human methods of solving yet, only about 4 or 5 simple ones, actually probably less, there are about 2 or 3 real rules and then 4 or 5 extrapolated rules that are just combinations of the first ones.</p>
<p>Anyway, in First Person mode there is flying around (No clip mode) as well as moving Lara Croft around (Optionally other MD3 models) with sort of appropriate animations based on velocity (But not facing direction yet).  One thing I have noticed is that half of the MD3 models I download have different file naming conventions, so at some stage I want to break out some Quake 3 action and see what file names it uses and use that as my standard.</p>
<p>Why all this other stuff in a Sudoku game?  Whichever game I am working at the time becomes my test bed application for whatever I feel like implementing when bored.  I really need to make a dedicated test bed that does nothing else but demonstrate stuff.  I&#8217;ve also split my game engine into <a href="http://breathe.git.sourceforge.net/git/gitweb.cgi?p=breathe/breathe;a=tree;f=include/spitfire;hb=HEAD">Spitfire</a> and <a href="http://breathe.git.sourceforge.net/git/gitweb.cgi?p=breathe/breathe;a=tree;f=include/breathe;hb=HEAD">Breathe</a> portions, which splits the library into two halves, the generic tools for any application (string, math, xml, md5 hashes etc.) and game specific features (<a href="http://www.opengl.org">OpenGL</a> rendering, audio, physics, MD3 animation, etc.) respectively.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2009/02/25/yearly-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>x86_64 Linux C/C++ Test</title>
		<link>http://chris.iluo.net/blog/2008/12/15/x86_64-linux-c-slash-c-plus-plus-test/</link>
		<comments>http://chris.iluo.net/blog/2008/12/15/x86_64-linux-c-slash-c-plus-plus-test/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 05:10:02 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[x86_64]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=36</guid>
		<description><![CDATA[I use: gcc cmake KDevelop RapidSVN Meld However, don&#8217;t go the websites, all of these are available in the (Default?) repositories, so you can either install them via yum, PackageKit or apt-get. Also note: RapidSVN and Meld are only needed &#8230; <a href="http://chris.iluo.net/blog/2008/12/15/x86_64-linux-c-slash-c-plus-plus-test/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I use:<br />
<a href="http://gcc.gnu.org/">gcc</a><br />
<a href="http://www.cmake.org/">cmake</a><br />
<a href="http://www.kdevelop.org/">KDevelop</a><br />
<a href="http://rapidsvn.tigris.org/">RapidSVN</a><br />
<a href="http://meld.sourceforge.net/">Meld</a></p>
<p>However, don&#8217;t go the websites, all of these are available in the (Default?) repositories, so you can either install them via <a href="http://en.wikipedia.org/wiki/Yellow_dog_Updater,_Modified">yum</a>, <a href="http://en.wikipedia.org/wiki/PackageKit">PackageKit</a> or apt-get.  Also note: RapidSVN and Meld are only needed if you want to use SVN.  Even KDevelop is not required if you have another text editor that you prefer such as gedit/vi/emacs.  If you want to create your provide your own make file then you don&#8217;t need cmake either.  </p>
<p>Anyway, so a simple application that just tests that you can do a 64 bit compile is pretty straight forward.<br />
<strong>1) Create your main.cpp file with a <em>int main(int argc, char* argv[]);</em> in it.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cmake" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Set the minimum cmake version</span>
<span style="color: #1f3f81; font-style: bold;">cmake_minimum_required</span> <span style="color: #197d8b;">(</span><span style="color: #077807; font-sytle: italic;">VERSION</span> 2.6<span style="color: #197d8b;">)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Set the project name</span>
<span style="color: #1f3f81; font-style: bold;">project</span> <span style="color: #197d8b;">(</span>size_test<span style="color: #197d8b;">)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Add executable called &quot;size_test&quot; that is built from the source file</span>
<span style="color: #666666; font-style: italic;"># &quot;main.cpp&quot;. The extensions are automatically found.</span>
<span style="color: #1f3f81; font-style: bold;">add_executable</span> <span style="color: #197d8b;">(</span>size_test main.cpp<span style="color: #197d8b;">)</span></pre></div></div>

<p><strong>2) Create a CMakeLists.txt that includes your main.cpp.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;iostream&gt;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> argv<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">int</span> <span style="color: #000040;">*</span>int_ptr<span style="color: #008080;">;</span>
  <span style="color: #0000ff;">void</span> <span style="color: #000040;">*</span>void_ptr<span style="color: #008080;">;</span>
  <span style="color: #0000ff;">int</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span>funct_ptr<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(char):        &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(short):       &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">short</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(int):         &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(long):        &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">long</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(long long):   &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">long</span> <span style="color: #0000ff;">long</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;------------------------------&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(float):       &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">float</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(double):      &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">double</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(long double): &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">long</span> <span style="color: #0000ff;">double</span><span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;------------------------------&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(*int):        &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>int_ptr<span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(*void):       &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>void_ptr<span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sizeof(*function):   &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>funct_ptr<span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bytes&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;------------------------------&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
  std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Architecture:        &quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>void_ptr<span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; bit&quot;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>3) cd to the directory of your CMakeLists.txt and run &#8220;cmake .&#8221; and then &#8220;make&#8221;</strong><br />
<strong>4) ./size_test output:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>char<span style="color: #7a0874; font-weight: bold;">&#41;</span>:        <span style="color: #000000;">1</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>short<span style="color: #7a0874; font-weight: bold;">&#41;</span>:       <span style="color: #000000;">2</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>int<span style="color: #7a0874; font-weight: bold;">&#41;</span>:         <span style="color: #000000;">4</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>long<span style="color: #7a0874; font-weight: bold;">&#41;</span>:        <span style="color: #000000;">8</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>long long<span style="color: #7a0874; font-weight: bold;">&#41;</span>:   <span style="color: #000000;">8</span> bytes
<span style="color: #660033;">------------------------------</span>
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>float<span style="color: #7a0874; font-weight: bold;">&#41;</span>:       <span style="color: #000000;">4</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>double<span style="color: #7a0874; font-weight: bold;">&#41;</span>:      <span style="color: #000000;">8</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span>long double<span style="color: #7a0874; font-weight: bold;">&#41;</span>: <span style="color: #000000;">16</span> bytes
<span style="color: #660033;">------------------------------</span>
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">*</span>int<span style="color: #7a0874; font-weight: bold;">&#41;</span>:        <span style="color: #000000;">8</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">*</span>void<span style="color: #7a0874; font-weight: bold;">&#41;</span>:       <span style="color: #000000;">8</span> bytes
sizeof<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>:   <span style="color: #000000;">8</span> bytes
<span style="color: #660033;">------------------------------</span>
Architecture:        <span style="color: #000000;">64</span> bit</pre></div></div>

<p>As you can see this is specific to x86_64.  The beauty of gcc is that by default it compiles to the architecture it is being run on.  I had previously thought that it would be a world of pain, making sure that my compiler built the right executable code and linked in the correct libaries.  I know this project doesn&#8217;t use any special libraries, but (because of cmake?) the process is exactly the same as using cmake under 32 bit to make 32 bit executables.  You just make sure that they are there using Find*.cmake and then add them to the link step:</p>

<div class="wp_syntax"><div class="code"><pre class="cmake" style="font-family:monospace;"><span style="color: #1f3f81; font-style: bold;">SET</span><span style="color: #197d8b;">(</span>LIBRARIES
  ALUT
  OpenAL
  GLU
  SDL
  SDL_image
  SDL_net
  SDL_ttf
<span style="color: #197d8b;">)</span>
<span style="color: #666666; font-style: italic;"># Some of the libraries have different names than their Find*.cmake name</span>
<span style="color: #1f3f81; font-style: bold;">SET</span><span style="color: #197d8b;">(</span>LIBRARIES_LINKED
  alut
  openal
  GLU
  SDL
  SDL_image
  SDL_net
  SDL_ttf
<span style="color: #197d8b;">)</span>
<span style="color: #1f3f81; font-style: bold;">FOREACH</span><span style="color: #197d8b;">(</span>LIBRARY_FILE <span style="color: #b08000;">${LIBRARIES}</span><span style="color: #197d8b;">)</span>
  <span style="color: #1f3f81; font-style: bold;">Find_Package</span><span style="color: #197d8b;">(</span><span style="color: #b08000;">${LIBRARY_FILE}</span> REQUIRED<span style="color: #197d8b;">)</span>
<span style="color: #1f3f81; font-style: bold;">ENDFOREACH</span><span style="color: #197d8b;">(</span>LIBRARY_FILE<span style="color: #197d8b;">)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Link our libraries into our executable</span>
<span style="color: #1f3f81; font-style: bold;">TARGET_LINK_LIBRARIES</span><span style="color: #197d8b;">(</span><span style="color: #b08000;">${PROJECT_NAME}</span> <span style="color: #b08000;">${LIBRARIES_LINKED}</span><span style="color: #197d8b;">)</span></pre></div></div>

<p>Note that we don&#8217;t actually have to specify the architecture for each package or even the whole executable.  This is taken care of by cmake.  Anyway, it is not some mysterious black magic, it is exactly the same as you&#8217;ve always been doing.  Cross compiling is slightly different, but basically you would just specify -m32 and make sure that you link against the 32 bit libraries instead.  If I actually bother creating another 32 bit executable in my life I&#8217;ll make sure that I document right here exactly how to do a cross compile from 64 bit.  </p>
<p>The advantages of <a href="http://en.wikipedia.org/wiki/X86-64">64 bit</a> are mmm, not so great unless you deal with really big files/memory ie. more than 4 GB.  Perhaps more practical are the extra and upgraded to 64 bit registers so you may see an increase in speed or <a href="http://en.wikipedia.org/wiki/Automatic_parallelization">parallelisation</a> of 64 bit operations, for example a game may want to use 64 bit colours (ie. 4x 16 bit floats instead of 4x 8 bit ints to represent an <a href="http://en.wikipedia.org/wiki/RGBA_color_space">rgba pixel</a>.  </p>
<p>Things to watch out for:<br />
int is still 32 bit!  If I were implementing the x86_64 version of C++ standard/gcc/in a perfect world this would have been changed to 64 bit, ie. &#8220;int&#8221; would be your native int size, it&#8217;s logical, it makes sense.  However, I do understand that this would have broken a lot of code.  The problem is, if int != architecture bits, then why have it at all, why not drop it from the standard and just have int32_t and int64_t and be done with it.  Then if a program chooses it can have:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">typedef</span> int32_t <span style="color: #0000ff;">int</span><span style="color: #008080;">;</span></pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">typedef</span> int64_t <span style="color: #0000ff;">int</span><span style="color: #008080;">;</span></pre></div></div>

<p>as it sees fit.  Anyway.<br />
Pointers are now 64 bit!  So you can use them with size_t but cannot use them with int<br />
Under linux x86_64 gcc sizeof(int*) == sizeof(function*), however, this is not guaranteed anywhere.  It may change on a certain platform/compiler.  Don&#8217;t do stuff like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> address <span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>originalvariable<span style="color: #008080;">;</span></pre></div></div>

<p>gcc should warn you (you may need to <a href="http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html">turn on these warnings</a> <em>-Wformat -Wconversion</em>).  </p>
<p>All in all, if you have been writing standard code and using make/cmake it should be relatively pain free to upgrade to 64 bit.  </p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2008/12/15/x86_64-linux-c-slash-c-plus-plus-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux x86_64</title>
		<link>http://chris.iluo.net/blog/2008/12/13/linux_x86_64/</link>
		<comments>http://chris.iluo.net/blog/2008/12/13/linux_x86_64/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 04:23:12 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[x86_64]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=33</guid>
		<description><![CDATA[I have been dipping my toe into x86_64 waters sporadically over the last couple of years. On each of the previous occasions it always seemed too immature, packages were way to hard to come by (I prefer precompiled binaries), half &#8230; <a href="http://chris.iluo.net/blog/2008/12/13/linux_x86_64/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been dipping my toe into x86_64 waters sporadically over the last couple of years.  On each of the previous occasions it always seemed too immature, packages were way to hard to come by (I prefer precompiled binaries), half my hardware didn&#8217;t work, strange crashes etc.  Seeing as this episode has been 100% successful, I thought this time I would document it.</p>
<div id="attachment_58" class="wp-caption alignright" style="width: 310px"><a href="http://chris.iluo.net/blog/wp-content/uploads/2008/12/screen_prompt_320x240_color_test.png"><img class="size-medium wp-image-58" title="screen_prompt_320x240_color_test" src="http://chris.iluo.net/blog/wp-content/uploads/2008/12/screen_prompt_320x240_color_test-300x225.png" alt="Fedora" width="300" height="225" /></a><p class="wp-caption-text">Fedora</p></div>
<p>My favourite distribution is <a href="http://fedoraproject.org">Fedora</a> due to it&#8217;s rapid development and ease of use.  I <a href="http://fedoraproject.org/en/get-fedora">downloaded</a> via <a href="http://en.wikipedia.org/wiki/BitTorrent">BitTorrent</a>.  (Obviously) make sure you get the x86_64 version.  I always like to run the sha checksum to rule out that as the problem if something does arise later.  I also make sure that my DVD verifies in my burning program after it has been burnt.</p>
<p>Now we are ready to install.  Unless you have something really exotic you should not need any special drivers or anything (At least not until after the install), it should just work.  The important parts of my hardware are:<br />
Asus A8V-E SE (Not awesome, my awesome motherboard blew up causing me to downgrade to this one I had lying around) AMD Socket 939<br />
AMD Athlon 64 X2 4800+ CPU<br />
nVidia GeForce 8600 GT 256MB PCIe</p>
<p>I use the onboard LAN and sound card, as well as 2 SATA drives, an IDE drive and an IDE CDROM.</p>
<p>So I installed Fedora from the DVD.  You can again choose to verify the media, weirdly (And in previous versions as well) this check always seems to fail even though the sha check and burning software verification succeed, so either the check is broken or the motherboard/drive is broken.  I have never seen this verification succeed in my life.  Anyway, I skip it now and the options I select (At appropriate times) are fresh install onto a blank drive, &#8220;Software Development&#8221; profile/packages (You can probably turn off the other profiles, you can install any required packages individually later on when you are in the OS anyway).  Next time I do an install I would love to try an <a href="http://docs.fedoraproject.org/install-guide/f10/en_US/ch-upgrading-system.html">upgrade install</a>.</p>
<p>That should all install (You don&#8217;t have to get too serious about selecting the right packages right now, I find it easier to install &#8220;generally&#8221; what I need (&#8220;Software Development&#8221;) and then customise later) and you should now be logging into a fresh install of Fedora 10.</p>
<p>Initially I had some problems with an additional PCI sound card I had present due out of habit because I had never gotten my on board sound to work for any motherboard under Linux.  Some programs were using the onboard and some where then using the PCI one, so I rebooted and went into the bios to disable the onboard one.  Both still get detected.  Apparently this is a common problem with this motherboard.  I went to update the bios and wouldn&#8217;t you believe it, the bios updater is Windows only.  Anyway, because the onboard sound card was being detected I just removed the PCI one and enabled the onboard one again.  That fixed it up awesomely and I had audio, yay.  Also removing PulseAudio can &#8220;unconfuse&#8221; applications and force them to use ALSA, <br />
<cite>yum remove alsa-plugins-pulseaudio</cite></p>
<p>I then noticed that I had some issues with audio playback stuttering, cycling through normal speed and then fast for a second and then normal again.  I fixed it by following <a href="http://forums.fedoraforum.org/showthread.php?t=206868">this tutorial</a>.</p>
<p>Add the <a href="http://rpm.livna.org/">Livna</a> repo by downloading and running <a href="http://rpm.livna.org/livna-release-10.rpm">the add repo rpm</a>, it is not linked to on the main page, but the url can be built from the other releases.  Add the <a href="http://www.rpmfusion.org/">RPMFusion</a> repo by downloading and running both the free and non-free <a href="http://rpmfusion.org/Configuration">add repo rpm</a>.<br />
For my information:<br />
<a href="http://www.rpmfusion.org/">RPMFusion</a> provides additional packages that are not in the base Fedora repos.<br />
<a href="http://rpm.livna.org/rlowiki/">Livna</a> provides the same packages as RPMFusion, but also provides the libdvdcss package for watching DVDs.</p>
<p><a href="http://chris.iluo.net/blog/wp-content/uploads/2008/12/glxgears.png"><img src="http://chris.iluo.net/blog/wp-content/uploads/2008/12/glxgears-284x300.png" alt="" title="glxgears" width="284" height="300" class="alignleft size-medium wp-image-63" /></a></p>
<p>I have never had much luck with ATI drivers for Linux.  I had heard the nVidia ones were easier to install and configure and apparently faster to boot.  Before you install drivers, you might want to get a benchmark of your FPS in <a href="http://en.wikipedia.org/wiki/GLX">glxgears</a> before installation:<br />
<cite>glxgears</cite></p>
<p>I downloaded and installed the nVidia (Binary, proprietary) driver:<br />
<em>sudo yum install kmod-nvidia</em></p>
<p>Now reboot (It&#8217;s the easiest way to restart X).  Test that hardware accelerate rendering is happening by looking for in the output of this command:<br />
<em>glxinfo | grep direct</em></p>
<p>And your glxgears FPS should be above 2000:<br />
<cite>glxgears</cite></p>
<p>Adobe recently released an x86_64 Linux version of Flash so we don&#8217;t have to mess around with nswrapper etc. any more.  I downloaded it from <a href="http://labs.adobe.com/downloads/flashplayer10.html">here</a>, extracted, <em>su</em>, <em>cp ./libflashplayer.so /usr/lib64/mozilla/plugins</em>, restarted Firefox.  You may want to <a href="http://weebls-stuff.com/toons/badgers/">test it</a> also.</p>
<div id="attachment_61" class="wp-caption alignright" style="width: 310px"><a href="http://chris.iluo.net/blog/wp-content/uploads/2008/12/nexuiz_screenshot_10_thumb.jpg"><img src="http://chris.iluo.net/blog/wp-content/uploads/2008/12/nexuiz_screenshot_10_thumb-300x240.jpg" alt="Nexuiz" title="nexuiz_screenshot_10_thumb" width="300" height="240" class="size-medium wp-image-61" /></a><p class="wp-caption-text">Nexuiz</p></div>
<p>For my benefit for next time, I also like:<br />
Neverball and Neverputt<br />
VDrift<br />
Torcs<br />
Nexuiz<br />
Open Arena<br />
Urban Terror<br />
XMoto</p>
<p>Transmission<br />
Thunderbird<br />
Rhythmbox<br />
VLC<br />
K3B<br />
Wine<br />
CMake<br />
KDevelop</p>
<p>I have not provided any links to these as they are all present in <a href="http://en.wikipedia.org/wiki/PackageKit">PackageKit</a> which comes with Fedora 10.</p>
<p>Also for my information:<br />
<strong>Firefox Add Ons</strong><br />
Adblock Plus<br />
Flashblock<br />
NoScript<br />
PDF Download<br />
FireBug</br /><br />
Nightly Tools</br /><br />
<a href="http://netusage.iau5.com/">Net Usage Item</a></p>
<p><strong>Open links in Firefox in the background</strong><br />
Type about:config into the address bar in Firefox, then look for the line browser.tabs.loadDivertedInBackground and set it  to true.</p>
<p><strong>Automatic Login</strong><br />
<cite>su gedit /etc/gdm/custom.conf</cite></p>
<p>And adding this text:<br />
<cite>[daemon]<br />
# http://live.gnome.org/GDM/2.22/Configuration<br />
TimedLoginEnable=true<br />
TimedLogin=yourusername<br />
TimedLoginDelay=30</cite></p>
<p><strong>NTFS Drives</strong><br />
Gnome automatically finds and mounts NTFS drives/partitions, however <a href="http://forums.fedoraforum.org/showthread.php?t=206692">in Fedora 9 and later, ownership is now broken</a>.  Each partition (And every sub folder and file) seems to default to ownership so even though some operations work such as moving files around, even adding and deleting, some programs will complain (I found this problem through RapidSVN not working).  Nautilus reports that you are not the owner and even if you run Nautilus as root you cannot change to owner to anything other than root.  The way I solved this was to install ntfs-config and run with:<br />
<cite>sudo ntfs-config</cite></p>
<p>You should now have valid entries in /etc/fstab:<br />
<cite>sudo cp /etc/fstab /etc/fstab.bak<br />
gksudo gedit /etc/fstab</cite></p>
<p>Something like this (One for each partition, the ones you are interested in are any with ntfs-3g):<br />
<em>UUID=A2D4DF1DD4DEF291	/media/DUMP	ntfs-3g	defaults,nosuid,nodev,locale=en_AU.UTF-8	0	0</em></p>
<p>I then edited each ntfs-3g line like so:<br />
<cite>UUID=A2D4DF1DD4DEF291	/media/DUMP	ntfs-3g	defaults,<strong>rw,user,uid=500,gid=500,umask=0022,</strong>nosuid,nodev,locale=en_AU.UTF-8	0	0</cite></p>
<p>Where uid=youruserid and gid=yourgroupid.  You can find these out via System-&gt;Administration-&gt;Users and Groups (There is probably a command to find this out, actually I would say there is definitely a command for finding this out, but I&#8217;m pretty lazy).  If you log in with different users perhaps changing to a common group would be better?  Reboot to let these settings take effect.  If you now to view your partition in Nautilus, File-&gt;Properties-&gt;Permissions should now list you as the owner with your group.</p>
<p>You now have a pretty well set up Fedora 10 installation.  These steps should be pretty similar for future versions.  I will probably refer back these when I install Fedora 11 or 12 in a year or two.  I love Fedora because it is the total opposite of Windows.  With Vista, Microsoft stagnated, waiting a year or two longer than they should have to release a product that by that time was out of touch with the target audience.  In contrast, I had been planning to install Fedora 9 this time around after installing 8 only 6-12 months ago, but I was pleasantly surprised to find that 10 had been released.  I would also like to try Ubuntu as I haven&#8217;t really used it much apart from at work, so I might give that a shot next time.  x86_64 has certainly matured over the last 2 or 3 years, I would say it is definitely production server ready and probably has been for at least a year.  The quality and variety of packages available for Linux is amazing, the community just keeps on giving.  Fedora just keeps on amazing me.  The future is bright, I can&#8217;t wait.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2008/12/13/linux_x86_64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Covers!</title>
		<link>http://chris.iluo.net/blog/2008/11/23/covers/</link>
		<comments>http://chris.iluo.net/blog/2008/11/23/covers/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 03:09:15 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[non-techical]]></category>
		<category><![CDATA[covers]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=26</guid>
		<description><![CDATA[Last night we went to The Pheonix (Where I met Christina almost 3 years ago!) and they had The Ellis Collective playing with two other bands. The girl on the violin was the highlight, reminding Sam and I of Fourplay. &#8230; <a href="http://chris.iluo.net/blog/2008/11/23/covers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last night we went to <a href="http://the-riotact.com/?p=9752">The Pheonix</a> (Where I met Christina almost 3 years ago!) and they had <a href="http://www.theelliscollective.com/">The Ellis Collective</a> playing with two other bands.  The girl on the violin was the highlight, reminding <a href="http://www.rephrase.net/">Sam</a> and I of <a href="http://www.fourplayjazz.com/">Fourplay</a>.  It would have been good if there were more violin solos, also the songs on their site just don&#8217;t do the violin justice.<br />
I heart <a href="http://en.wikipedia.org/wiki/Cover_version">covers</a>.  No wait, I heart covers more than everyone in the world put together.  YouTube is awesome for finding covers, it can be quite patchy, but basically everyone votes down the worst ones so you only view the gold.</p>
<p><a href="http://www.youtube.com/user/johnnyonline">Johnny</a> from Australia.<br />
<a href="http://www.youtube.com/user/kinagrannis">Kina Grannis</a></p>
<p><a href="http://www.youtube.com/watch?v=UMZVVwHS4rI">Johnny sings Exit Music (from a Film) by Radiohead</a> (And he does drums as well, awesome (Well not at the same time, but still awesome)).<br />
<a href="http://www.youtube.com/watch?v=8wQabvrA2XI">Kina sings 1234 by Fiest</a><br />
<a href="http://www.youtube.com/watch?v=VvEmnfUX3NE">Johnny sings Waltz #2 by Elliot Smith</a><br />
<a href="http://www.youtube.com/watch?v=SzoQtq0MLeg">Kina sings New Soul by Yael Naïm</a><br />
<a href="http://www.youtube.com/watch?v=jZ54eZlGx4s">Johnny sings Mad World by Gary Jules </a><br />
<a href="http://www.youtube.com/watch?v=szB74WuelHI">Johnny sings Karma Police by Radiohead</a></p>
<p><a href="http://www.youtube.com/watch?v=aTuVnX1ZGPA">Kina sings Hallelujah by Leonard Cohen</a><br />
<a href="http://www.youtube.com/watch?v=aTuVnX1ZGPA">Johnny sings Hallelujah by Leonard Cohen</a><br />
No one is as awesome as Hallelujah <a href="http://www.youtube.com/watch?v=AratTMGrHaQ">Jesus himself</a> though.</p>
<p>I also heart mashups.<br />
<a href="http://www.youtube.com/user/jackcontemusic">Jack Conte</a> specialises in both covering and mashing up songs, some of them are downloadable <a href="http://www.myspace.com/jackconte">at</a>.<br />
<a href="http://www.youtube.com/watch?v=0X-PRpqj7N4">Jack Conte &#8211; Radiohead/Chopin mashup/cover</a><br />
<a href="http://www.youtube.com/watch?v=eA-kf_4D2Ro&amp;feature=related">Jack Conte &#8211; Gorillaz &#8211; Feel Good Inc. cover</a> watch this if only for the ending hilarious.<br />
<a href="http://www.youtube.com/watch?v=SW0ulJ5QCcw&amp;feature=related">Jack Conte &#8211; Aphex Twin/Bright Eyes mashup/cover</a></p>
<p>This wouldn&#8217;t be a blog entry by Chris if it didn&#8217;t include:<br />
<a href="http://www.youtube.com/watch?v=l05Qi-ZjeRQ">Johnny sings *cough* Britney *cough*</a><br />
<a href="http://chris.iluo.net/files/Yael Naim.zip">Yael Naïm New Soul and Toxic</a></p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2008/11/23/covers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>const int vs. enum vs. #define</title>
		<link>http://chris.iluo.net/blog/2008/11/01/const-int-vs-enum-vs-define/</link>
		<comments>http://chris.iluo.net/blog/2008/11/01/const-int-vs-enum-vs-define/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 03:02:56 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[c++]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=12</guid>
		<description><![CDATA[Example A: int GetValue0&#40;&#41; &#123; return 10; &#125; &#160; int GetValue1&#40;&#41; &#123; return 10 + 10; &#125; &#160; int GetValue2&#40;&#41; &#123; return 10 * 10; &#125; So if all of the values 10 represent a common magic number then you &#8230; <a href="http://chris.iluo.net/blog/2008/11/01/const-int-vs-enum-vs-define/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Example A:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> GetValue0<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> GetValue1<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">10</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> GetValue2<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">10</span> <span style="color: #000040;">*</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>So if all of the values 10 represent a common <a href="http://en.wikipedia.org/wiki/Magic_number_(programming)">magic number</a> then you are going to want to extract that value to one location instead of the 5 that it is in at the moment.  How do we do this?</p>
<p>Say we call the value MAGIC_NUMBER (Of course, in a real life situation you would use a better name than this, wouldn&#8217;t you?  Something like PI, GST_PERCENTAGE, NUMBER_OF_CLIENTS, etc.) we would then have this code.</p>
<p>Example B:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> GetValue0<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> MAGIC_NUMBER<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> GetValue1<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> MAGIC_NUMBER <span style="color: #000040;">+</span> MAGIC_NUMBER<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> GetValue2<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> MAGIC_NUMBER <span style="color: #000040;">*</span> MAGIC_NUMBER<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Great.  The problem now is, how do we tell our program about MAGIC_NUMBER?  </p>
<p>If you originally started programming C then your first instinct may be to use:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#define MAGIC_NUMBER 10</span></pre></div></div>

<p>The main problem here is that the compiler may not realise that all of the places you use MAGIC_NUMBER are linked so it may not realise that it can factor it out.  The other problem with this method is the lack of type safety.  You can use MAGIC_NUMBER with sign/unsigned ints, char, bool etc.  The compiler may not warn you about converting between these types.  For an int this isn&#8217;t really a problem, but const float PI = 3.14&#8230;f should give you a warning when you try to initialise an int to it.  This is good news as it requires you to cast if you really want to do it, which then shows other programmers than you have actually thought about what you are doing and what is happening to the value as it passes through each variable.  </p>
<p>You might be tempted to use:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> MAGIC_NUMBER <span style="color: #000080;">=</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span></pre></div></div>

<p>This is much better as it adds type safety, however you can do even better than that,</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> MAGIC_NUMBER <span style="color: #000080;">=</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span></pre></div></div>

<p>This way it isn&#8217;t &#8220;just&#8221; a global variable, when you declare it as const you are telling the compiler that it will never change in value which means that it can make all sorts of assumptions about how it will be used.  Your compiler may or may not factor out/in this value, it may or may not insert 10 + 10 and 10 * 10 into those functions for you at compile time.  Using a const int means that the compiler gets the choice of using either the value directly or using a variable containing that value, and I trust the compiler more than myself to make that decision.  Because it knows the value of MAGIC_NUMBER at compile time and knows that it will never change at runtime it can actually do the calculation and insert that value instead.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> GetValue0<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> GetValue1<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">20</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> GetValue2<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">100</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The other magic number container is enum.  It varies slightly to const int as it is more for collections of values where you want to identify something by what type it is.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">enum</span> RESULT
<span style="color: #008000;">&#123;</span>
  RESULT_FILE_DOWNLOADED,
  RESULT_CONNECTION_FAILED, 
  RESULT_FILE_NOT_FOUND,
  RESULT_DISCONNECTED
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
RESULT DownloadFile<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> std<span style="color: #008080;">::</span><span style="color: #007788;">string</span><span style="color: #000040;">&amp;</span> url<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #666666;">// Pseudocode</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>could not connect<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">return</span> RESULT_CONNECTION_FAILED<span style="color: #008080;">;</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>file not found<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">return</span> RESULT_FILE_NOT_FOUND<span style="color: #008080;">;</span> 
&nbsp;
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>disconnected<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">return</span> RESULT_DICONNECTED<span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">return</span> RESULT_FILE_DOWNLOADED<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>In this way we can get rid of magic numbers and (In C++0x at least with <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Strongly_typed_enumerations">enum class</a>) get some type safety, your compiler will hopefully complain if you try and return an integer instead of a RESULT.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2008/11/01/const-int-vs-enum-vs-define/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crank very early testing of heightmap and basic physics</title>
		<link>http://chris.iluo.net/blog/2008/02/02/crank-very-early-testing-of-heightmap-and-basic-physics/</link>
		<comments>http://chris.iluo.net/blog/2008/02/02/crank-very-early-testing-of-heightmap-and-basic-physics/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 21:16:02 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[crank]]></category>
		<category><![CDATA[gamedev]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=8</guid>
		<description><![CDATA[This is what I have been working on in my spare time. I think it is going alright. I still have to do: The brakes can&#8217;t be locked up at the moment, they always give a little so you can&#8217;t &#8230; <a href="http://chris.iluo.net/blog/2008/02/02/crank-very-early-testing-of-heightmap-and-basic-physics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/aHPVFrJhbWc"></param> <embed src="http://www.youtube.com/v/aHPVFrJhbWc" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
<p>This is what I have been working on in my spare time.  I think it is going alright.  I still have to do:<br />
The brakes can&#8217;t be locked up at the moment, they always give a little so you can&#8217;t for example lean on the front wheel and hold the brakes and expect to stay in the same place.<br />
Create the level editor, at the moment the level is just a bunch of sin waves added together.<br />
Add a little bit of <a href="http://en.wikipedia.org/wiki/Parallax_scrolling">parallax scrolling</a> to add a bit of interest and depth.<br />
Create better artwork for example shocks and rider.<br />
Add dynamic bike bits such as suspension that compresses and a rider that leans forwards and backwards and has a weight (At the moment I fake weight transfer by just rotating the bike).  </p>
<p><a href="http://breathe.svn.sourceforge.net/viewvc/breathe/">Library source</a><br />
<a href="http://firestartergame.svn.sourceforge.net/viewvc/firestartergame/crank/">Game source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2008/02/02/crank-very-early-testing-of-heightmap-and-basic-physics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Call of Duty 4 AI and difficulty levels</title>
		<link>http://chris.iluo.net/blog/2007/12/17/call-of-duty-4-ai-and-difficulty-levels/</link>
		<comments>http://chris.iluo.net/blog/2007/12/17/call-of-duty-4-ai-and-difficulty-levels/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 21:00:53 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[gamedev]]></category>
		<category><![CDATA[call of duty 4]]></category>
		<category><![CDATA[fps]]></category>
		<category><![CDATA[ghillie]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=5</guid>
		<description><![CDATA[I started and finished Call of Duty 4 yesterday. Basically it is war themed FPS that tries to capture the feeling of helplessness of being in a war. The standard method for creating each level in a game like this &#8230; <a href="http://chris.iluo.net/blog/2007/12/17/call-of-duty-4-ai-and-difficulty-levels/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I started and finished <a href="http://en.wikipedia.org/wiki/Call_of_Duty_4:_Modern_Warfare">Call of Duty 4</a> yesterday.  Basically it is war themed <a href="http://en.wikipedia.org/wiki/First-person_shooter">FPS</a> that tries to capture the feeling of helplessness of being in a war.  The standard method for creating each level in a game like this (<a href="http://en.wikipedia.org/wiki/Quake_1">Quake 1</a>) is to create the &#8220;map&#8221; that the player will run around in and then manually add a series of points (Spawn points) in the map that represent each bad guy.  So if you add 20 points, you will have 20 bad guys.  Another method is to specify 100 spawn points and then spawn 20 bad guys at 20 of those points, which mixes it up a little bit so that the game is less predictable.  In earlier games like Quake 1 and Wolfenstein, these bad guys have a problem where they just sit on their starting position until they saw the player, at which point they would basically run straight at the player shooting, pretty simple stuff.  </p>
<p>Call of Duty differs slightly from other games:<br />
a) I think there are actually fewer spawn points than in a conventional game, however,<br />
b) There is not a 1 to 1 mapping of bad guys to spawn points, bad guys constantly stream out of these spawn points.<br />
c) These spawn points are placed slightly off the player accessible part of the map, and then the enemies jump over walls, emerge from doors and alleyways, helicopter and rapel in, etc.  </p>
<p>There are also the usual predictable, &#8220;There&#8217;ll be a guy behind the door here, a guy will run through now&#8221;, but it&#8217;s much less noticable.  Each spawn just continuously spawns bad guys until you either get to a certain pointon the map at which point the next spawn point will start spawning, or a time constrain runs out (&#8220;Defend this point for 2 minutes&#8221;).  </p>
<p>All of the Call of Duty games (And most FPS games in general) have a configurable difficulty system consisting of something like &#8220;Easy&#8221;, &#8220;Medium&#8221;, &#8220;Hard&#8221;, &#8220;Insane&#8221;.  The problem is that it is usually set for the whole game so you choose medium and go to the first level which introduces you to the game, then the levels get progressively harder, now the problem is that the first level isn&#8217;t a real representation of the difficulty.  By the middle of the game it can feel way to hard or way to easy.  <a href="http://en.wikipedia.org/wiki/Grand_Theft_Auto_(series)">Grand Theft Auto</a> solves this problem by having every player play the same difficulty and then the missions get progressively harder until I give up and don&#8217;t finish the game, so that solution isn&#8217;t without its problems.  It would be much better if every game were Grand Theft Auto style, but were the game adapted to how good the player was.  Some games are already similar to this, but instead of lowering/raising the difficulty of the enemies they give you more or less health and ammunition.  However it could be possible to exploit this method by playing badly until the last level and then easily beat the last few levels and completing the game.  The other problem is how to differentiate between a good and bad player.  Each player would have a few areas where they are judged, such as health at the end of each level, health lost per enemy encountered (A ratio something like 15% health lost per enemy killed), speed through the level, accuracy with each weapon/speed.  You could even add other things such as exploration of the level, stealth and variety of weapons/styles.  </p>
<p>It&#8217;s hard to tell the difference between whether a player is going slow because they aren&#8217;t competent enough or if they are just taking their time and being methodical for example.  The other problem is how do tell the player&#8217;s speed through the game?  The easiest (And roughest) way is to get their total time through the level from entry to exit.  You could also have points along the typical player&#8217;s route and time the player between them, or find the average time between the player seeing each enemy and killing them, or the total kills divided by the total level time.  You could even have an experienced player play through the game, then a less experienced player, recording both their play and then scaling the difficulty based on which one the player is playing most like.  </p>
<p>Another interesting method would be to identify a few main playing styles such as <a href="http://en.wikipedia.org/wiki/Bunny_hopping">bunnyhopping</a>, <a href="http://en.wikipedia.org/wiki/Rush_(computer_and_video_games)">rushing</a>, <a href="http://en.wikipedia.org/wiki/Camping_(computer_gaming)">camping</a>.  You could then spawn more or less enemies and at different distances from the player to force the player into the mode you want them to be in.  For example if they are rushing, spawn more enemies behind the player or above the player to force them to take their time and look around a bit more.  If the player is taking too much time and sniping too much, spawn some enemies just around the corner who will rush the player and force her to switch to a short range weapon.  </p>
<p>The first mission of Call of Duty 4 is the unskippable training mission for people who have never played an FPS before.  &#8220;Here&#8217;s a gun, here&#8217;s a target, here&#8217;s a grenade, etc.&#8221;.  It takes about 10 minutes and should be skippable considering that almost everyone who plays will have played an FPS previously and a lot of them would have actually played previous Call of Duty games.  It is a prime candidate for starting with a message box that says &#8220;Do you want to try a training mission before you get stuck in?&#8221;.  Another option would be to have everyone go straight to the first real mission and either start real slow, with a run through the woods or something with lots of running and one enemy every minute and then gradually introducing the player to other weapons and skills (&#8220;Here&#8217;s a grenade, throw it with this button&#8230;&#8221;, &#8220;Crouch behind this wall so that the guard can&#8217;t see you&#8221;).  </p>
<p>Anyway, it&#8217;s a good game, but doesn&#8217;t really do anything the previous versions didn&#8217;t do.  The highlight for me was running around in <a href="http://en.wikipedia.org/wiki/Ghillie_suit">Ghillie</a> hiding awesomely.  It would have been better if there were a lot more Ghillie suit missions.  Being the gunner for the DC aircraft was fun too but went on way too long.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2007/12/17/call-of-duty-4-ai-and-difficulty-levels/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Welcome</title>
		<link>http://chris.iluo.net/blog/2007/11/23/welcome/</link>
		<comments>http://chris.iluo.net/blog/2007/11/23/welcome/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 07:38:45 +0000</pubDate>
		<dc:creator>pilkch</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[go chris!]]></category>
		<category><![CDATA[welcome]]></category>

		<guid isPermaLink="false">http://chris.iluo.net/blog/?p=3</guid>
		<description><![CDATA[Hullo!  If you are reading this I have now moved from LiveJournal to my self hosted WordPress blog.  I am aiming to post at least one article per month, hardly a challenge, but hopefully I can sustain at least this &#8230; <a href="http://chris.iluo.net/blog/2007/11/23/welcome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hullo!  If you are reading this I have now moved from LiveJournal to my self hosted WordPress blog.  I am aiming to post at least one article per month, hardly a challenge, but hopefully I can sustain at least this poor effort.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.iluo.net/blog/2007/11/23/welcome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
