<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Cocoa Geek</title>
	<atom:link href="http://www.cocoageek.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cocoageek.com</link>
	<description>The Cocoa Geek Blog</description>
	<pubDate>Mon, 03 Nov 2008 19:51:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
			<item>
		<title>Lighttpd</title>
		<link>http://www.cocoageek.com/2008/11/lighttpd/</link>
		<comments>http://www.cocoageek.com/2008/11/lighttpd/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 19:51:55 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[Admin Stuff]]></category>

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

		<guid isPermaLink="false">http://www.cocoageek.com/?p=106</guid>
		<description><![CDATA[Ever since i started this blog i have been using Apache2 as the webserver and i have been quite happy with it, however recently i have noticed that it uses an insane amount of RAM. I have 240Meg of ram on this VPS and almost all of it was eaten by Apache after a few [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Ever since i started this blog i have been using Apache2 as the webserver and i have been quite happy with it, however recently i have noticed that it uses an insane amount of RAM. I have 240Meg of ram on this VPS and almost all of it was eaten by Apache after a few days uptime - even hacking the .conf files didn&#8217;t do too much to rectify this. So i decided to look elsewhere, having used lighttpd on my development machine since April i decided that i could probably roll it out on here. This was really easy to accomplish and wordpress was nice and simple to setup afterwards in order to maintain my permalink structure - there are plenty of blog posts out there on exactly how to do this so i won&#8217;t add to that comment on here.</p>
<p style="text-align: left;">
<p style="text-align: left;">Generally i think as a web-server it is easier to set-up and configure than apache - setting up an RRD perl script to log my RAM and CPU usage was a dodle as was all the fastCGI stuff. I&#8217;ve not yet tried to do anything too fancy like serving a ROR app or a JAVA app or anything like that, although now i have the RAM to spare i might have to give it a go&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/11/lighttpd/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu 8.10</title>
		<link>http://www.cocoageek.com/2008/10/ubuntu-810/</link>
		<comments>http://www.cocoageek.com/2008/10/ubuntu-810/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 19:49:59 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[General Development]]></category>

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

		<guid isPermaLink="false">http://www.cocoageek.com/?p=104</guid>
		<description><![CDATA[The new version of Ubuntu is out now - so a great time for everybody to try linux. It really is a top-notch distro and increadably easy to configure. Go fo it.
]]></description>
			<content:encoded><![CDATA[<p>The new version of Ubuntu is out now - so a great time for everybody to try linux. It really is a top-notch distro and increadably easy to configure. Go fo it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/10/ubuntu-810/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Intrepid Ibex</title>
		<link>http://www.cocoageek.com/2008/10/intrepid-ibex/</link>
		<comments>http://www.cocoageek.com/2008/10/intrepid-ibex/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 17:52:30 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[General Development]]></category>

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

		<guid isPermaLink="false">http://www.cocoageek.com/?p=102</guid>
		<description><![CDATA[The new version of Ubuntu is coming in a couple of weeks, and since it has now entered beta phase i decided i would upgrade my installation of Hardy Heron. The installation is very easy just requiring the command:
sudo update-manager -d
The installation is remarkably quick, installing all the updated packages. The only problem i had [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">The new version of Ubuntu is coming in a couple of weeks, and since it has now entered beta phase i decided i would upgrade my installation of Hardy Heron. The installation is very easy just requiring the command:</p>
<p style="text-align: justify;"><code>sudo update-manager -d</code></p>
<p style="text-align: justify;">The installation is remarkably quick, installing all the updated packages. The only problem i had with the installation was my GRUB config file was overwritten meaning i had to re-write some entries. As with previous upgrades config file diffs can be displayed and merged as required.</p>
<p style="text-align: justify;">After a quick restart and reconfiguring my display drivers (very easy - just a matter of picking the correct driver) i was in 8.10. Changing my theme and background to the new artwork i was very pleased to see the removal of that awful orange that has been used in previous versions, its now quite a nice dark and moody brown which reminds me somewhat of Ubuntu Studio.</p>
<p style="text-align: justify;">On the whole it has been remarkably stable, since the feature freeze is coming in now then future updates are going to be entirely focused on  fixing bugs. I am currently running the update commands about twice a day and getting at least 15 packages updated each time.</p>
<p>I can&#8217;t wait until it is fully stable and released at the end of this month, Ubuntu is getting stronger and stronger as a desktop OS and with the current 6 monthly release cycle its also moving very quickly. I think a huge amount of credit should go to the community for working so hard on bug fixing and packaging. Making this OS the easiest linux distro to get started with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/10/intrepid-ibex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Moving House</title>
		<link>http://www.cocoageek.com/2008/10/moving-house/</link>
		<comments>http://www.cocoageek.com/2008/10/moving-house/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 22:17:21 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[Admin Stuff]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=96</guid>
		<description><![CDATA[I have (over the last couple of days) shifted the server on which cocoageek.com is hosted, this has meant reconfiguring the whole database and http server as well as the blog etc. This is still in process, which means some things might not be working perfectly just yet. The process was quite easy but not [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I have (over the last couple of days) shifted the server on which cocoageek.com is hosted, this has meant reconfiguring the whole database and http server as well as the blog etc. This is still in process, which means some things might not be working perfectly just yet. The process was quite easy but not perfect - so if you notice any problems can you please send me a direct message on my <a title="twitter" href="http://twitter.com/pixelsmack" target="_self">twitter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/10/moving-house/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Strace, Truss &#038; Dtrace</title>
		<link>http://www.cocoageek.com/2008/09/strace-truss-dtrace/</link>
		<comments>http://www.cocoageek.com/2008/09/strace-truss-dtrace/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 22:51:42 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[General Development]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=86</guid>
		<description><![CDATA[At work, attempting to port a large program from linux to Solaris i hit a snag - I successfully compiled it with the Sun C compiler in 32 bit successfully. However this needed to be ported to 64 bit. The compilation was fine all the errors were solved with relative success by passing compiler flags [...]]]></description>
			<content:encoded><![CDATA[<p>At work, attempting to port a large program from linux to Solaris i hit a snag - I successfully compiled it with the Sun C compiler in 32 bit successfully. However this needed to be ported to 64 bit. The compilation was fine all the errors were solved with relative success by passing compiler flags and finding the correct libraries, unfortunately running it gave an instance Segmentation fault.</p>
<p>A Segmentation Fault is a fault that is given when a program tries to use memory to which it does not have permission either by trying to read or write to it&#8230; Basically it is a total pain in the ass&#8230; Debugging these types of problems can be tricky.</p>
<p>Using C one of the most common, and first found causes of this is with the scanf() function. For instace compiling the following code will read a number from the standard input and write it back out:</p>
<pre class="source-c"><span class="co2">#include &lt;stdio.h&gt;</span>

<span class="kw4">int</span> main<span class="br0">(</span><span class="kw4">void</span><span class="br0">)</span> <span class="br0">{</span>
  <span class="kw4">int</span> n;
  <span class="kw1">while</span> <span class="br0">(</span>scanf<span class="br0">(</span><span class="st0">"%d"</span>, &amp;n<span class="br0">)</span> == <span class="nu0">1</span><span class="br0">)</span>{
    <span class="kw3">printf</span> <span class="br0">(</span><span class="st0">"%d<span class="es0">\n</span>"</span>, n<span class="br0">)</span>;
  }
  <span class="kw1">return</span> <span class="nu0">0</span>;
<span class="br0">}</span></pre>
<p>Running this should work fine, now lets try editing this code and instead of passing &amp;n (the pointer) as an option to scanf() lets just pass the int n:</p>
<pre class="source-c"><span class="co2">#include &lt;stdio.h&gt;</span>

<span class="kw4">int</span> main<span class="br0">(</span><span class="kw4">void</span><span class="br0">)</span> <span class="br0">{</span>
  <span class="kw4">int</span> n;
  <span class="kw1">while</span> <span class="br0">(</span>scanf<span class="br0">(</span><span class="st0">"%d"</span>, n<span class="br0">)</span> == <span class="nu0">1</span><span class="br0">)</span>
    <span class="kw3">printf</span> <span class="br0">(</span><span class="st0">"%d<span class="es0">\n</span>"</span>, n<span class="br0">)</span>;
  <span class="kw1">return</span> <span class="nu0">0</span>;
<span class="br0">}</span></pre>
<p>Running this will give us a segmentation fault. This in a large program can be insanely difficult to debug as your pointer could be defined a long time before it has been called to a function. So how can you start to debug this?</p>
<p>Well the tool i used for the first time was truss (the linux version being strace, and the osx version being dtrace) what this does is allow you to view as system calls a process makes as it is being called - or at what system call it crashes on. In other words if you are trying to open a file or read a memory address that can&#8217;t be called you will see it here:</p>
<pre>read(0, "1\n", 1024)                    = 2</pre>
<pre>--- SIGSEGV (Segmentation fault) @ 0 (0) ---</pre>
<pre>+++ killed by SIGSEGV +++</pre>
<p>Here is the final lines of output after running the strace command on my faulty scanf() code. It shows clearly that my program dies as i try to read the line from the standard input. The other important thing is that i didn&#8217;t have to recompile my code with a debugging flag to try to work out where my bug was. Strace (etc) reads the system calls - therefore telling you when and where you read memory or files, remember here that unix assumes they are essentially the same thing.</p>
<p>There is a huge amount of these programs that i haven&#8217;t talked about here - it is a very simple use of the command however one i wanted to document (as much for my own reference in the future as much as for anyone else!) because it is an essential command for trying to figure out why a program is dying, you don&#8217;t even need the source code in order to do this kind of debugging. I think its also important to be aware that this tool can also be used for ensuring your code is secure, integer wrapping or other similar vulnerabilities can be assessed using tools like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/09/strace-truss-dtrace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Spore</title>
		<link>http://www.cocoageek.com/2008/09/spore/</link>
		<comments>http://www.cocoageek.com/2008/09/spore/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 18:17:10 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=82</guid>
		<description><![CDATA[Yesterday i picked up Spore, all i can say is: what a game. I&#8217;m not a big gamer anymore - don&#8217;t suppose being a mac guy i can be really, but this is superb. It is such a well thought out and fun game. I hadn&#8217;t been playing for more than 10mins before it managed [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday i picked up Spore, all i can say is: what a game. I&#8217;m not a big gamer anymore - don&#8217;t suppose being a mac guy i can be really, but this is superb. It is such a well thought out and fun game. I hadn&#8217;t been playing for more than 10mins before it managed to get my girlfriend&#8217;s interest. As I write this post she has been playing for the last half an hour and loving it. It is great fun a game for all the family&#8230; ok thats it now&#8230; i&#8217;m going to get my game back&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/09/spore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Chrome</title>
		<link>http://www.cocoageek.com/2008/09/google-chrome/</link>
		<comments>http://www.cocoageek.com/2008/09/google-chrome/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 20:22:50 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[General Development]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=79</guid>
		<description><![CDATA[Google has developed a web browser. Lets face it no one is really surprised, there have been rumours of this for months and with the impending release of Android i don&#8217;t suppose that an increased level of web integration on mobile devices and the desktop from google is any shock either.
I do however find it [...]]]></description>
			<content:encoded><![CDATA[<p>Google has developed a web browser. Lets face it no one is really surprised, there have been rumours of this for months and with the impending release of Android i don&#8217;t suppose that an increased level of web integration on mobile devices and the desktop from google is any shock either.</p>
<p>I do however find it very interesting that they have chosen to use webkit as the back end for the browser as opposed to gecko. Google has long funded mozilla and therefore the gecko platform, webkit however was a fork of the knoqueror browsers KHTML by apple. Apple prefers open source projects it works on and with to be under a BSD style license in order that the code can be used in close source applications, this is a possibility for using webkit over gecko.</p>
<p>Ultimately googles choice of rendering engine has little impact on the success of their browser, the usability and compliance with the web-applicatios that people use will be far and away more important in the success or faliure of Chrome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/09/google-chrome/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LLVM-GCC benchmarks</title>
		<link>http://www.cocoageek.com/2008/08/llvm-gcc-benchmarks/</link>
		<comments>http://www.cocoageek.com/2008/08/llvm-gcc-benchmarks/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 14:25:56 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[General Development]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=70</guid>
		<description><![CDATA[Over the weekend i compiled LLVM and the LLVM-GCC front-end on ubuntu mostly because of all the hype surrounding it at the moment. Alot of people are talking about the optimization improvements over GCC and the increase in performance it give - if all the hype is to be believed no one would be using [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Over the weekend i compiled LLVM and the LLVM-GCC front-end on ubuntu mostly because of all the hype surrounding it at the moment. Alot of people are talking about the optimization improvements over GCC and the increase in performance it give - if all the hype is to be believed no one would be using GCC anymore. So what is the state of play with it at the moment?</p>
<p>Well its biggest breakthrough up until now has been its inclusion with OS X with xCode 3.1. Although not currently the default compiler it is still there and there has been alot of talk about it being shifted to the default compiler in the near future. I imagine this would happen as apple have been funding alot of the development of LLVM themselves, they seem to view it as being one of the parts that will dramatically increase performance in the future on OS X particularly in regard to the multi-threading advancements in Snow Leopard.</p>
<p>In the Ubuntu / Debian world there isn&#8217;t quite as much support yet for the compiler, trying the packaged off the Ubuntu repositories is a waste of time at the moment, they are badly packaged, badly named and to be honest don&#8217;t work out of the box. Reading the mailing lists would give us the picture that there is a large effort to put these into the upstreams for the next Ubuntu release (Intrepid). So i compiled them from the sources, one important thing to point out that is not in the documentation for those who do want to compile them on linux is that they require the gperf package - and won&#8217;t give you an error until it is too late, i ended up starting the whole thing again. Other than that compilation is nice and easy.</p>
<p>So how about performance? Well first of all i tried re-compiling some of my favorite apps with the LLVM-GCC compiler and i didn&#8217;t get one error. Adding the -Wall flag however did miss some warnings out that are flagged up by GCC.  Compile times seemed generally quicker however i didn&#8217;t actually do any measurements for this yet.</p>
<p>Execution performance was something else i tried to measure, i got hold of  a very CPU intensive calculation off a friend and compiled it with both GCC and LLVM-GCC, the GCC execution time in 3 runs all averaged out to 55s with a SD of &gt; 0.02 of a second. Running the same calculation compiled from LLVM-GCC gave a mean execution time of 38 seconds with the same SD - thats a saving of 30% in this example.</p>
<p>The code i was running for this test is typical scientific number crunching with 64bit ints, so this is obviously a very useful advantage and time saver on a calculation that would take longer to run.</p>
<p>The next thing i tried was running the amber granular synth, again this was compiled with both of the compilers and again i ran each execution 3 times. I chose one of the example run&#8217;s from the documentation the only change being i increased the size of the output file from 5s to 60s. Again there was a quicker performance with the LLVM-GCC compiler although this time not quite as impressive. The mean for the GCC compiled version was 1.433s, the mean for the LLVM-GCC version was 1.186s. This is a time saving of roughly 20%.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">These results obviously show that LLVM-GCC does live upto some of its hype, however it will be interesting to see what the state of play is like in a couple of years. Will it still be being talked about in the same way? Or will the GCC guys improve their optimization techniques in future versions? I am still interested in testing it in other ways as well, these tests were both CPU intensive but not really data intensive. That will be the next set of tests that i will try.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/08/llvm-gcc-benchmarks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Slightly esoteric jam session</title>
		<link>http://www.cocoageek.com/2008/08/slightly-esoteric-jam-session/</link>
		<comments>http://www.cocoageek.com/2008/08/slightly-esoteric-jam-session/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 17:47:23 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=63</guid>
		<description><![CDATA[Well on monday night a regular band practice managed to turn into an electronic jam session, which we took some live recordings of. These are avalible for listening pleasure on music.cocoageek.com. These are performances by myself and richhoo.
]]></description>
			<content:encoded><![CDATA[<p>Well on monday night a regular band practice managed to turn into an electronic jam session, which we took some live recordings of. These are avalible for listening pleasure on <a href="http://music.cocoageek.com">music.cocoageek.com</a>. These are performances by myself and <a href="http://twitter.com/richhoo">richhoo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/08/slightly-esoteric-jam-session/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eskimo 0.1</title>
		<link>http://www.cocoageek.com/2008/07/eskimo-01/</link>
		<comments>http://www.cocoageek.com/2008/07/eskimo-01/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 18:50:49 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cocoageek.com/?p=59</guid>
		<description><![CDATA[I have finally gotten around to releasing a binary of Eskimo my to-do manager for OS X. This is deffinitly still in development and the feature set is far from complete. Download it here.
]]></description>
			<content:encoded><![CDATA[<p>I have finally gotten around to releasing a binary of Eskimo my to-do manager for OS X. This is deffinitly still in development and the feature set is far from complete. Download it <a title="here" href="http://www.cocoageek.com/eskimov/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocoageek.com/2008/07/eskimo-01/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
