<?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>hostby.net &#187; Development</title>
	<atom:link href="http://hostby.net/home/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://hostby.net/home</link>
	<description>Find your website a home with hostby.net</description>
	<lastBuildDate>Sun, 14 Mar 2010 19:25:32 +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>OpenTK &#8211; C# and OpenGL made easy</title>
		<link>http://hostby.net/home/2008/09/08/opentk-csharp-and-opengl-made-easy/</link>
		<comments>http://hostby.net/home/2008/09/08/opentk-csharp-and-opengl-made-easy/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 14:55:12 +0000</pubDate>
		<dc:creator>hostby.net</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[opentk]]></category>

		<guid isPermaLink="false">http://hostby.net/home/?p=93</guid>
		<description><![CDATA[One of the major side projects we are working on requires the use of the real-time 3D graphics using OpenGL technology. Normally this type of project would be the preserve of the C++ developer. However C++ is renowned for its difficult and lengthy development time which was something we wished to avoid. By using C# [...]]]></description>
			<content:encoded><![CDATA[<p>One of the major side projects we are working on requires the use of the real-time 3D graphics using OpenGL technology.  Normally this type of project would be the preserve of the C++ developer.  However C++ is renowned for its difficult and lengthy development time which was something we wished to avoid.</p>
<p>By using C# we hoped to be able to rapidly develop our 3D app whilst also giving us easy portability between Windows and Linux systems though the <a href="http://www.mono-project.com">mono project</a>.</p>
<p>The established major OpenGL binding for C# is the <a href="http://www.taoframework.com/">Tao Framework</a>.  This framework has been around for a number of years and includes a number of additional bindings.  However it has several major problems;  the first of which is the design of libraries API is non-intuitive and adds lot of unnecessary typing.  The second and most important factor for me is its missing the ability to easily write text to the screen, something you think should be remarkably simple.</p>
<p>Of cource the arguement is that Tao is just a direct binding to the C libraries, this is where OpenTK steps in.  It provides the low level OpenGL access you need as well as higher level helper functions for faster and easier development.</p>
<p>So how does <a href="http://www.opentk.com">OpenTK</a> compare to the Tao Framework?  <a href="http://www.opentk.com/node/447">Interestingly OpenTK is acctually based on the Tao Framework</a>, so you get the same underlying code.  The biggest difference to me has been the ease of writing code.  OpenTK has much better type safety compared to Tao and the API is by far more logical.  This makes writing the code a pleasure compare to Tao.  The most useful aspect by far of OpenTk is its helper libraries, these save you from having to reinvent the wheel and include Vectors, Matrix and <a href="http://en.wikipedia.org/wiki/Quaternion">Quaternions</a> as well as the all important printing text to the screen!</p>
<p>If you are considering working with OpenGL and C# I would highly recommend investigating OpenTK as one of your options.</p>
<p><a href="http://hostby.net/home/wp-content/uploads/2008/09/test.jpg"><img class="aligncenter size-full wp-image-95" title="Teaser Image" src="http://hostby.net/home/wp-content/uploads/2008/09/test.jpg" alt="" width="320" height="240" /></a></p>
<p>Above is a little teaser from the project we are working on.  If you do a little bit of research you should be able to track it down&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hostby.net/home/2008/09/08/opentk-csharp-and-opengl-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GetTickCount in Linux</title>
		<link>http://hostby.net/home/2008/08/21/gettickcount-linux/</link>
		<comments>http://hostby.net/home/2008/08/21/gettickcount-linux/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 16:00:53 +0000</pubDate>
		<dc:creator>hostby.net</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[gettickcount]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[subspace]]></category>

		<guid isPermaLink="false">http://hostby.net/home/?p=75</guid>
		<description><![CDATA[Took me ages to find the EXACT equivalent but this seems to do the trick. uint32_t GetTickCount(void) { tms tm; return times(&#38;tm)*10; } At least it did on my port of ddirserv from Windows to Linux.]]></description>
			<content:encoded><![CDATA[<p>Took me ages to find the EXACT equivalent but this seems to do the trick.</p>
<p><code>uint32_t GetTickCount(void)<br />
{<br />
tms tm;<br />
return times(&amp;tm)*10;<br />
}</code></p>
<p>At least it did on my <a href="http://forums.minegoboom.com/viewtopic.php?p=78134">port of ddirserv</a> from Windows to Linux.</p>
]]></content:encoded>
			<wfw:commentRss>http://hostby.net/home/2008/08/21/gettickcount-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centos 5 and mpm-itk</title>
		<link>http://hostby.net/home/2008/07/12/centos-5-and-mpm-itk/</link>
		<comments>http://hostby.net/home/2008/07/12/centos-5-and-mpm-itk/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 14:21:12 +0000</pubDate>
		<dc:creator>hostby.net</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[mpm-itk]]></category>

		<guid isPermaLink="false">http://hostby.net/home/?p=13</guid>
		<description><![CDATA[EDIT: If you just want to get on and use mpm-itk on Centos 5 please check the comments as Sascha Schieferdecker has very kindly compiled some up to date binaries. A long time ago someone got fed up with suexec suphp and other methods of preventing virtual hosting users messing each others accounts up. They [...]]]></description>
			<content:encoded><![CDATA[<p><strong>EDIT: If you just want to get on and use mpm-itk on Centos 5 please check the comments as <cite><a rel="external nofollow" href="http://www.sascha-schieferdecker.de/"></a></cite>Sascha Schieferdecker has very kindly compiled some up to date binaries.<br />
</strong></p>
<p>A long time ago someone got fed up with suexec suphp and other methods of preventing virtual hosting users messing each others accounts up.  They realised that the real problem was not that there was a module missing from Apache to do it, but rather the design of Apache is such that its impossible to make it secure in a per user way.  After reading Stuart Herbert <a href="http://blog.stuartherbert.com/php/2007/11/21/the-challenge-with-securing-shared-hosting/">discussion</a> of the pros and cons of different solutions to this problem and his <a href="http://blog.stuartherbert.com/php/2008/04/19/using-mpm-itk-to-secure-a-shared-server/">evaluation of mpm-itk</a> i decided to look into it further.</p>
<p>On nice solution that has  been developed is <a href="http://www.telana.com/peruser.php">mpm-peruser </a>but that seemed to spawn a great many processes and have performance issues so I took a look at the much simpler <a href="http://mpm-itk.sesse.net/">mpm-itk</a>.  Fortunately on Debian this module is already prepackaged, unfortunately CentOS does not have a rpm for it, nor could I find one by searching.  The only option left was to patch the source httpd rpm myself.</p>
<p><span id="more-13"></span></p>
<p>Unfortunately there is only a <a href="http://mitka.us/articles/mpm-itk/">guide for CentOS 4</a> online, which does not work with CentOS 5.  A little bit of searching on the CentOs wiki found me these two links</p>
<ul>
<li> <a href="http://www.owlriver.com/tips/non-root/">http://www.owlriver.com/tips/non-root/</a></li>
<li><a href="http://www.owlriver.com/tips/patching_srpms/">http://www.owlriver.com/tips/patching_srpms/</a></li>
</ul>
<p>The second was most useful as what we wanted to do was patch the SRPMS (Source RPMS) which are then compiled into RPMS.  By looking though the Diff file posted in the previous guide I was able to produce a modified .spec file, which I have attached at the end of this article along with the final RPMS.  Once we had the .spec file modified correctly I tried to compile the RPMs but came accross a very obsure error which was the result of the the latest mpm-itk patch not being compatable with the version of Apache that comes with CentOS 5.  To work around this I had to locate the older patch which is not directly linked on the website.  By a bit of googling and guesswork later I had found the location of the <a href="http://mpm-itk.sesse.net/apache2.2-mpm-itk-20070425-00.patch">older patch.</a></p>
<p>After these shinnigans the RPMS compiled and it was time to test them.  I soon realised I had to make a change to my /etc/sysconfig/httpd file to use the mpm-itk binary and edit httpd.conf to ensure I doesnt try to serve pages as the root user.</p>
<p><strong>Anyway&#8230;here is the guide.</strong></p>
<p>Standard Disclaimer myself and hostby.net take no responsibility for any damages, bad things or anything else that happens as the result of following this guide</p>
<p>First we ensure we are NOT the root user.  Building RPMS as root is a bad idea.</p>
<p>Once we are using a non-root user, we first need to setup our RPM build enviroment.<br />
<code>cd<br />
wget http://www.oldrpm.org/hintskinks/buildtree/RPM-build-tree.txt<br />
chmod 755 RPM-build-tree.txt<br />
./RPM-build-tree.txt<br />
</code><br />
Now create our own buiding area and download CentOS 5 apache2 SRPM.<br />
<code>mkdir ~/build<br />
mkdir ~/build/httpd-itk<br />
cd ~/build/httpd-itk<br />
wget http://isoredirect.centos.org/centos/5/os/SRPMS/httpd-2.2.3-11.el5_1.centos.3.src.rpm<br />
</code><br />
At this point its good to test you can build the RPM normally before we apply any patches<br />
<code>rpmbuild --rebuild httpd-2.2.3-11.el5_1.centos.3.src.rpm<br />
</code><br />
If this fails you might have to &#8220;yum install&#8221; some additional packages.  I&#8217;m assuming you managed to get this to work so we continue.</p>
<p>At this point we copy the rpm spec file for httpd to our own folder so we can customise it<br />
<code>cp ~/rpmbuild/SPECS/httpd.spec httpd-itk.spec<br />
</code><br />
To save you some effort I&#8217;ve provided both a diff and the .spec file i used. Basically you change the file to apply an additional patch and compile an extra mpm.</p>
<p><code>cd ~/rpmbuild/SOURCES<br />
wget http://mpm-itk.sesse.net/apache2.2-mpm-itk-20070425-00.patch<br />
nano apache2.2-mpm-itk-20070425-00.patch<br />
</code></p>
<p>I had to make one tiny change to the patch to make it compile.<br />
after this line (1878)</p>
<p><code>+#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)<br />
</code><br />
Insert this extra row<br />
<code>+#define MPM_VALID_PID(p) (getpgid(p) == getpgrp())<br />
</code></p>
<p>Now we change back to our folder and use the spec file we modified (or the one i provided <a href="http://hostby.net/home/wp-content/uploads/2008/07/httpd-itk.spec">httpd-itk.spec</a>) and recompile the rpm.<br />
<code>cd ~/build/httpd<br />
rpmbuild -ba httpd-itk.spec<br />
</code><br />
If all goes well this should  compile with no errors.  In the folder ~/rpmbuild/RPMS you should have a nice new set of RPMS which include mpm-itk.  The only way to find out is of course to test it.  Now we change to root<br />
<code>su<br />
cd /home/userwebuildrpmsas/rpmbuild/RPMS<br />
rpm -U httpd-2.2.3-11.itk.3.i386.rpm  mod_ssl-2.2.3-11.itk.3.i386.rpm httpd-devel-2.2.3-11.itk.3.i386.rpm  httpd-manual-2.2.3-11.itk.3.i386.rpm<br />
</code><br />
Now check that mpm-itk has been installed.<br />
<code>httpd.itk -l<br />
</code><br />
Compiled in modules:<br />
core.c<br />
prefork.c<br />
http_core.c<br />
mod_so.c</p>
<p>In order for the httpd service to use the mpm you need to make a few changes as its disabled by default.  First of all edit httpd.conf and add the following lines.<br />
<code># itk modules</code></p>
<p>AssignUserID apache apache<br />
StartServers       8<br />
MinSpareServers    5<br />
MaxSpareServers   20<br />
ServerLimit      256<br />
MaxClients       256<br />
MaxRequestsPerChild  4000</p>
<p>Then edit /etc/sysconfig/httpd and add this line<br />
<code>HTTPD=/usr/sbin/httpd.itk</code></p>
<p>Restart apache and you should notice all the processes are httpd.itk now <img src='http://hostby.net/home/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Attachments</p>
<p><a href="http://hostby.net/home/wp-content/uploads/2008/07/httpd-223-11itk3i386.rpm">httpd-223-11itk3i386.rpm</a> <a href="http://hostby.net/home/wp-content/uploads/2008/07/httpd-devel-223-11itk3i386.rpm">httpd-devel-223-11itk3i386.rpm</a> <a href="http://hostby.net/home/wp-content/uploads/2008/07/httpd-manual-223-11itk3i386.rpm">httpd-manual-223-11itk3i386.rpm</a> <a href="http://hostby.net/home/wp-content/uploads/2008/07/mod_ssl-223-11itk3i386.rpm">mod_ssl-223-11itk3i386.rpm</a> <a href="http://hostby.net/home/wp-content/uploads/2008/07/httpd-itk.spec">httpd-itk.spec</a> <a href="http://hostby.net/home/wp-content/uploads/2008/07/httpdspec.diff">httpd.spec.diff</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hostby.net/home/2008/07/12/centos-5-and-mpm-itk/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
