<?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>Arek Zen</title>
	<atom:link href="http://www.zenebo.com/word/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zenebo.com/word</link>
	<description>Day in the life of a coder  &#124;   Aspicio.meum. by Arek Bochinski</description>
	<pubDate>Thu, 05 Jun 2008 05:08:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Reverse complement FASTA benchmark</title>
		<link>http://www.zenebo.com/word/tools/reverse-complement-of-fasta-bechmark/</link>
		<comments>http://www.zenebo.com/word/tools/reverse-complement-of-fasta-bechmark/#comments</comments>
		<pubDate>Thu, 08 May 2008 09:31:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[C and C++]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=17</guid>
		<description><![CDATA[FASTA format is used in bioinformatics to describe peptide sequences or nucleic acid sequences.
One of the benchmarks at the computer languages game requires that a program parse a 'stdin' redirected input of these FASTA formated sequences and print the content of the sequence in reverse order. Each character in the sequence should also be complemented [...]]]></description>
			<content:encoded><![CDATA[<p><strong>FASTA </strong>format is used in bioinformatics to describe peptide sequences or nucleic acid sequences.</p>
<p>One of the benchmarks at the computer languages game requires that a program parse a 'stdin' redirected input of these <strong>FASTA </strong>formated sequences and print the content of the sequence in reverse order. Each character in the sequence should also be complemented according to this translation table:</p>
<pre>code  meaning   complement

A    A                   T
C    C                   G
G    G                   C
T/U  T                   A
M    A or C              K
R    A or G              Y
W    A or T              W
S    C or G              S
Y    C or T              R
K    G or T              M
V    A or C or G         B
H    A or C or T         D
D    A or G or T         H
B    C or G or T         V
N    G or A or T or C    N</pre>
<p><strong>Headers</strong></p>
<p>Each sequence contains a header with an id and description. These lines are printed 'as is' .</p>
<p><strong>Challenges</strong></p>
<ul>
<li>String reversal</li>
<li>Translation table substitution</li>
<li>Input handling and memory allocation</li>
</ul>
<p><strong>String Reversal</strong></p>
<p>Sequences are reversed using a bitwise XOR and without using a temporary character or string buffers.</p>
<p>Operations are performed in a loop where <em>forward</em> is the first index and <em>end</em> is the last index in the sequence.</p>
<p>buffer[forward]^=buffer[end];<br />
buffer[end]^=buffer[forward];<br />
buffer[forward]^=buffer[end];</p>
<p><strong>Translation table substitution</strong></p>
<p>A small character array of complement values is created and accessed with the integer value of the source character matching to arrays index. For example:</p>
<p>buffer[end]=FtoCOMP[buffer[end]];</p>
<p>Buffer at index <em><strong>end</strong></em> will receive a character at index <em><strong>'buffer[end]</strong></em>' from translation table array <em><strong>FtoCOMP</strong></em>. Index 'buffer[end]' translated to an integer , will point to a desired complement . This speeds up the process of substitution and allows for very fast array index notation.</p>
<p><strong>Input handling</strong></p>
<p>The requirement to handle input one line at a time corresponds quite well to the translation procedure. In pseudo-code,</p>
<ul>
<li>process one line at a time</li>
<li>for each sequence , print header line, reverse the sequence, translate it into its complement and print it out</li>
</ul>
<p>Only one buffer is used as a destination for reading input. Beginning pointer where each line is placed is dictated by moving a pointer through a character array. Once a line is read in, we check if it is the last line in a sequence by peeking into the input stream. If it is , it is processed according to above instructions and beginning pointer where the next line is placed is reset to 0.</p>
<p><strong>These functions are called for each line N in the input stream:</strong></p>
<p>fgets_unlocked, fgetc_unlocked.</p>
<p>These functions are called for each line that's not a header line:</p>
<p>ungetc, strlen.</p>
<p>Other functions are called only at the end of a sequence and do not approach N runtime. This version written in C language has been compiled and tested using kernel 2.6.24 with GCC 4.2.3 .</p>
<p><strong>Compile command:</strong></p>
<p>gcc -Wall -O3 -fomit-frame-pointer revc.c -o revc.gcc_run</p>
<p>Source code is located here: <a title="http://zenebo.com/revc.c.tar.gz" href="http://zenebo.com/revc.c.tar.gz" target="_blank">http://zenebo.com/revc.c.tar.gz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/tools/reverse-complement-of-fasta-bechmark/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Atoi() or not to Atoi()</title>
		<link>http://www.zenebo.com/word/tools/atoi-or-not-to-atoi/</link>
		<comments>http://www.zenebo.com/word/tools/atoi-or-not-to-atoi/#comments</comments>
		<pubDate>Mon, 05 May 2008 03:14:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[C and C++]]></category>

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=14</guid>
		<description><![CDATA[Update: May 13th, 2008
My solution has been accepted and placed in the interesting alternative category. A bitter-sweet victory considering my program as tested by their standards is the fastest C language entry . It is still a small honor to be recognized and to know that my entry shaved off almost 30% off the next [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update: May 13th, 2008</strong></p>
<p><em>My solution has been accepted and placed in the interesting alternative category. A bitter-sweet victory considering my program as tested by their standards is the fastest C language entry . It is still a small honor to be recognized and to know that my entry shaved off almost 30% off the next fastest C program.</em></p>
<p><em>Let's see how the FASTA benchmark program stacks up in the next few days.</em></p>
<p><em>Cheers.</em></p>
<p>see it here: <a title="http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&amp;lang=all" href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&amp;lang=all" target="_blank">http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&amp;lang=all</a></p>
<p>The computer language benchmarks game at <a title="http://shootout.alioth.debian.org/gp4/index.php" href="http://shootout.alioth.debian.org/gp4/index.php" target="_blank">http://shootout.alioth.debian.org/gp4/index.php</a> matches up a fundamental processing task or algorithm in a variety of programming languages. One benchmark called 'sumfile' has the following requirements:</p>
<ul>
<li>read integers from stdin, one line at a time</li>
<li>print the sum of those integers</li>
</ul>
<p>It is based on this icon program:</p>
<pre><strong>procedure main(argv)</strong></pre>
<pre><strong> sum:=0</strong></pre>
<pre><strong> while(sum+:=read())</strong></pre>
<pre><strong> write (sum)</strong></pre>
<pre><strong>end
</strong></pre>
<p>The C language entry topped at 6th and 7th place. Surprising as it was, a Java 6 version came in second with more than a second shaved off the total CPU running time.</p>
<p>The task for all of these is to read a flat file containing one integer per line, add the integer to the total and print out the sum at the end. Three versions of test files containing 1,000, 11,000 and 21,000 lines are used. While there could be more interesting ways to tackle this task, it's trivial and simple demands warranted a quick look.</p>
<p>The fastest C program used these function calls per each line in the file:</p>
<p>fgets_unlocked() , atoi() and a += operator to sum up the total. It seems that either one of these functions could be improved on, but since line-by-line reading is a strict requirement thus leaving the atoi function open to critique.</p>
<p>This following function will return an integer given a string. It handles positive and negative number strings.</p>
<pre><strong>int matoi(char *c) {</strong></pre>
<pre><strong>int res = 0,n=1;</strong></pre>
<pre><strong>if(*c=='-'){n=-1;*c++;}</strong></pre>
<pre><strong>while (*c &gt;= '0' &amp;&amp; *c &lt;= '9')</strong></pre>
<pre><strong>res = res * 10 + *c++ - '0';</strong></pre>
<pre><strong>return res*n;</strong></pre>
<p><strong>}</strong></p>
<p>When compared to the standard atoi() function and parsing 500,000 lines of integers, this version on a 2.4 GHz Core2Duo performed 60% better . It's simplicity is also it's weakness as the matoi() function is designed to handle proper input. Perfect for a situation where input is controlled.</p>
<p>Original benchmark entry was modified with timing capture and the addition of matoi() function. Header contains any previous entry owners and information.</p>
<p>Archive with source code : <a title="http://zenebo.com/sum1.c.tar.gz" href="http://zenebo.com/sum1.c.tar.gz" target="_blank">http://zenebo.com/sum1.c.tar.gz </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/tools/atoi-or-not-to-atoi/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lighttz - a simple and fast web server</title>
		<link>http://www.zenebo.com/word/asynchronous-programming/lighttz-a-simple-and-fast-web-server/</link>
		<comments>http://www.zenebo.com/word/asynchronous-programming/lighttz-a-simple-and-fast-web-server/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 23:59:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Asynchronous Programming]]></category>

		<category><![CDATA[Lighttz Web Server]]></category>

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=10</guid>
		<description><![CDATA[Update : A naive implementation of using Lua 5.1 to generate a dynamic response has been added. This loads Lua, loads a Lua script and executes it. Retrieves the string response and returns it to the browser. Take a look below for a new additional download link.
Cheers
There are many well written , fast web servers [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>U</strong></em><em><strong>pdate </strong></em>: A naive implementation of using Lua 5.1 to generate a dynamic response has been added. This loads Lua, loads a Lua script and executes it. Retrieves the string response and returns it to the browser. Take a look below for a new additional download link.</p>
<p><em>Cheers</em></p>
<p>There are many well written , fast web servers around with full features for CGI , FastCGI , proxying and dynamic language support such as Ruby, PHP and Python. So what is Lighttz ? It's a small HTTP server written in C , benchmarked against the big guns. It is by no means a replacement for the big four, and is mainly a testing showcase. For the sake of brevity, the comparison of the first benchmarks will compare the following web servers:</p>
<ul>
<li><strong>Apache/2.2.8-mpm-prefork</strong></li>
<li><strong>lighttpd/1.4.19</strong></li>
<li><strong>nginx/0.5.33</strong></li>
<li><strong>userver-0.6.0 - compiled and run with epoll support<br />
</strong></li>
<li><strong>lighttz/0.1 - libev epoll event model<br />
</strong></li>
</ul>
<p><strong>Short summary and the configuration as tested is below. Please note that other event models such as select and poll are available under each server , but these were picked for the performance or wide use ( in case of Apache ) .<br />
</strong></p>
<p><strong>Apache - <a title="http://httpd.apache.org/" href="http://httpd.apache.org/" target="_blank">http://httpd.apache.org/</a><br />
</strong></p>
<p>The usual pre-forking server most, widely used to power many websites.</p>
<p><strong>Lighttpd - <a title="http://www.lighttpd.net/" href="http://www.lighttpd.net/" target="_blank">http://www.lighttpd.net/</a><br />
</strong></p>
<p>Also a very popular server. Instead of a forking model, it utilizes a fast a very well performing epoll mechanism.</p>
<p><strong>Nginx - <a title="http://sysoev.ru/en/" href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br />
</strong></p>
<p>A little younger but equally fast server , which also utilizes epoll event model.</p>
<p><strong>Userver - <a title="http://userver.uwaterloo.ca/index.php" href="http://userver.uwaterloo.ca/index.php" target="_blank">http://userver.uwaterloo.ca/index.php</a><br />
</strong></p>
<p>A small, microwebserver that's mostly used for tests and benchmarks. Project is maintained at University of Waterloo.</p>
<p><strong>Lighttz -<br />
</strong></p>
<p>A short C program that simulates an HTTP server and handles the requests using Libev and epoll.</p>
<p><strong>Test platform</strong></p>
<p>Ubuntu 8.04 , Kernel 2.6.24-16 SMP , 2GB RAM, Core2Duo 2.4GHz</p>
<p><strong>Benchmarking Client Program</strong></p>
<p>ApacheBench . Command used:</p>
<p>ab -c1000 -n1000000 &lt;host:port&gt; . The test document <em>index.html </em>is a 357 byte static file. Lighttz did not use the static file, it sent out the exact same contents as <em>index.html </em>contained in a char array.</p>
<p>The above simulated 1000 concurrent clients making 1000000 requests .</p>
<h3><strong>Results</strong></h3>
<p>Each result is an average of three runs with one pre-warming run to let each server utilize the cache.</p>
<p><strong>Requests per second. Listed in order of fastest to slowest.<br />
</strong></p>
<ol>
<li>Lighttz - 14,719 ( Cpu usage: 40-50% , Memory: 188 KB , 1 process )</li>
<li>Lighttpd - 14,701 ( Cpu usage: 65-85%, Memory: 6.6 MB , 1 process )</li>
<li>Nginx - 14,378 (Cpu usage: 65-80%,  Memory: 2.1 MB , 2 processes )</li>
<li>Userver - 13,221 ( Cpu usage: 75-90%, Memory: 1.2 MB, 1 process )</li>
<li>Apache - 9,512 ( Cpu Usage: 60-80%, Memory: 3.5 MB x 147 processes ,  514 MB total )</li>
</ol>
<p>Hardware used, other running servers and operating systems will reflect different results. The tests were not run to define maximum performance for all solutions. Each application will apply a different level of stress on the server.</p>
<p>Source code for Lighttz : <a title="http://zenebo.com/lighttz.c.tar.gz" href="http://zenebo.com/lighttz.c.tar.gz" target="_blank">http://zenebo.com/lighttz.c.tar.gz</a></p>
<p>Lua version: <a title="http://zenebo.com/lighttz_lua.tar.gz" href="http://zenebo.com/lighttz_lua.tar.gz" target="_blank">http://zenebo.com/lighttz_lua.tar.gz</a></p>
<p>Libev : <a title="http://software.schmorp.de/pkg/libev.html" href="http://software.schmorp.de/pkg/libev.html" target="_blank">http://software.schmorp.de/pkg/libev.html</a></p>
<p>Index.html file was taken from SuperJared.com article located here: <a title="http://superjared.com/entry/benching-lighttpd-vs-nginx-static-files/" href="http://superjared.com/entry/benching-lighttpd-vs-nginx-static-files/" target="_blank">http://superjared.com/entry/benching-lighttpd-vs-nginx-static-files/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/asynchronous-programming/lighttz-a-simple-and-fast-web-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GUI546 - Pong &#124;.    &#124;</title>
		<link>http://www.zenebo.com/word/c-and-c-plus-plus/gui546-pong/</link>
		<comments>http://www.zenebo.com/word/c-and-c-plus-plus/gui546-pong/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 00:33:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[C and C++]]></category>

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=9</guid>
		<description><![CDATA[Assignment 2 for GUI546 at Seneca College in Graphical User Interface (GUI) Programming
Who doesn't like Pong ? A breakout hit of epic proportions, Pong has traversed a long and arduous path into our hearts.
The program is written in C++.Net and utilizes basic Windows GDI features to simulate a game of Pong.
Login
Once the program runs, it [...]]]></description>
			<content:encoded><![CDATA[<p>Assignment 2 for GUI546 at Seneca College in Graphical User Interface (GUI) Programming</p>
<p>Who doesn't like Pong ? A breakout hit of epic proportions, Pong has traversed a long and arduous path into our hearts.</p>
<p>The program is written in C++.Net and utilizes basic Windows GDI features to simulate a game of Pong.</p>
<p><strong>Login</strong></p>
<p>Once the program runs, it requires the user to login. Login process creates a flat binary file in the same directory as the executable.</p>
<p>The archive below has one pre-registered user:</p>
<p>Login:demo</p>
<p>Password:demo1!</p>
<p><strong>Implementation</strong></p>
<p>Core of the program is based around learning graphical user interface programming using C++.Net , expanding concepts of threading and communicating a managed application with an unmanaged dynamic link library file. The program loads a previously created unmanaged Win32 .dll file from the ReleaseDll directory.</p>
<p>The program does not attempt to adhere to actual rules of Pong nor does it try to play with intelligence. I like to win , what can I say <img src='http://www.zenebo.com/word/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Zip archive is located here: <a title="GUI546 Assignment 2" href="http://zenebo.com/gui546a2.zip" target="_blank">http://zenebo.com/gui546a2.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/c-and-c-plus-plus/gui546-pong/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSC209 - Location Server</title>
		<link>http://www.zenebo.com/word/c-and-c-plus-plus/csc209-location-server/</link>
		<comments>http://www.zenebo.com/word/c-and-c-plus-plus/csc209-location-server/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 21:36:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[C and C++]]></category>

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=8</guid>
		<description><![CDATA[Assignment 4 for CSC209 at University of Toronto in Software Tools      and Systems Programming
Introduction
One of the interesting features of MSN Messenger is that you can see if a person is online and be able to look up their personal status . Some fields can be used to indicate a status [...]]]></description>
			<content:encoded><![CDATA[<p>Assignment 4 for CSC209 at University of Toronto in Software Tools      and Systems Programming</p>
<p><strong>Introduction</strong></p>
<p>One of the interesting features of MSN Messenger is that you can see if a person is online and be able to look up their personal status . Some fields can be used to indicate a status such as : <em>at work or at home</em></p>
<p>The task in this assignment is to write a server and a client that allows user to register with the server and see which other registered users are on .</p>
<p><strong>Specification</strong></p>
<p>A user will run the <em>heythere </em>client and connect to a <em>heythere-server</em> . Every N seconds, the server will send to the client a list of users that are currently registered and their status.</p>
<p><strong>Client</strong></p>
<p>The <em>client </em>first sends the user name to the server. The second message the client sends to the server is the location of the client . Other messages can be sent to the server. User can change their user name, the location and it may add a <em>message </em>tag .</p>
<p>Every <em>time interval </em>in seconds, the server will send a complete list of the currently logged on users. The client will print these out to <em>stdout</em> .</p>
<p>Each message has a strict format described as following:</p>
<p>First 3 characters describe the type of message the client is sending followed by a space and then the content of the message .</p>
<p><em>Location: <strong>usr</strong></em></p>
<p><em>Hostname: <strong>loc</strong></em></p>
<p><em>Message:<strong> tag</strong></em></p>
<p><strong>Server</strong></p>
<p>Server is written to support up to 30 clients at a time. It uses <em>select </em>to multiplex between different clients. If the command-line arguments <em>-t &lt;time interval&gt; </em>are not given, the default value for the number of seconds between printing to the clients is 10 seconds . Information will be written on line per client in the following format:</p>
<p><em>&lt;user name&gt; &lt;location&gt; &lt;message tag&gt;</em></p>
<p>To handle client data, the server collects the information from all connected clients.</p>
<p>Zip archive is located here: <a title="CSC209 Assignment 4" href="http://zenebo.com/csc209a4.zip" target="_blank">http://zenebo.com/csc209a4.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/c-and-c-plus-plus/csc209-location-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSC209 - build . a simple make-like tool</title>
		<link>http://www.zenebo.com/word/tools/csc209-build-a-simple-make-like-tool/</link>
		<comments>http://www.zenebo.com/word/tools/csc209-build-a-simple-make-like-tool/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 21:05:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Shell Prorgamming]]></category>

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

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

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=7</guid>
		<description><![CDATA[Assignment 1 for CSC209 course at University of Toronto in Software Tools      and Systems Programming
Build
In this assignment a student is required to write a program in Bourne shell that performs some of the same operations that make does . A simpler file format for a build file is specified , [...]]]></description>
			<content:encoded><![CDATA[<p>Assignment 1 for CSC209 course at University of Toronto in Software Tools      and Systems Programming</p>
<p><strong>Build</strong></p>
<p>In this assignment a student is required to write a program in Bourne shell that performs some of the same operations that <strong><em>make</em></strong> does . A simpler file format for a build file is specified , which does not follow all rules of the <strong><em>make </em></strong>program .</p>
<p><strong>Build file format</strong></p>
<p>There are 4 types of valid lines in a build file:</p>
<ol>
<li>A blank line. I.e., a line containing nothing but whitespace.</li>
<li>A line whose first character is # which indicates that the remainder  of the line is a comment.</li>
<li>A line whose first character is an @ followed by a space, and then  followed by one or more words separated by a single space. This type of 		line marks the beginning of a build rule.  The @ is ignored. 		The first word in the sequence is the target of the rule, and the 		remaining words, if any, are the prerequisites for the rule.</li>
<li>Other lines are considered action lines which should be executable  statements.</li>
</ol>
<p>In example:<br />
<code>#Comment line<br />
@target prerequisite1 prerequisite2<br />
action<br />
action with arguments<br />
</code></p>
<p><strong>Functionality and Implementation</strong></p>
<p><code>build</code> program will take one or two arguments.  The first argument is the target that you want to build. The second argument is the name of the build file to the program will read.  If the second argument is not present, the program will try to read a file in the current working directory called <code>buildfile</code>.</p>
<p>Steps:</p>
<ol>
<li>Read the build file looking for the appropriate rule.  If found:</li>
<li>Update prerequisites. (as with <code>make</code>, each 		prerequisite corresponds to a target in the buildfile, so we might 		need to execute another rule to ensure that a prerequisite is up to 		date.)</li>
<li>If the target is a file and has been modified more 	  recently than all of its prerequisites, then the actions are not 	  executed.</li>
<li>If the target is not a file, or any of the prerequisites 	  are newer than the target, then the rule's actions are executed.</li>
</ol>
<p>Exceptions:</p>
<ul>
<li>If a rule has no prerequisites, then the rule will always be executed 		when it is encountered.  Note that this differs from 		<code>make</code> where a rule with no prerequisites is only 		executed if it is called explicitly.</li>
<li>You don't need to handle recursive targets and prerequisites.</li>
</ul>
<p>The build process will likely want to call the <code>build</code> program from within the <code>build</code> program.  (Recursion comes in many forms.) 	  The best way to do this is to make sure that <code>build</code> is in 	  a directory in the <code>PATH</code> variable.</p>
<p><strong>Testing</strong></p>
<p>Another obvious use for shell scripts is to automate testing programs. We will also write a shell script called <code>testbuild</code> that 	  will run several tests of the <code>build</code> program.</p>
<p>The <code>testbuild</code> program will run at least 3 different test cases that test different parts of the program. We will also need to include one or more build files and possibly some other files. The <code>touch</code> (see "man touch") command will come in quite handy when we want to change a file's modification time automatically.</p>
<p>Zip archive can be obtained here: <a title="CSC209 Assignment 1" href="http://zenebo.com/csc209a1.zip" target="_blank">http://zenebo.com/csc209a1.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/tools/csc209-build-a-simple-make-like-tool/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DSA555 - Peg jump / solitaire solver</title>
		<link>http://www.zenebo.com/word/c-and-c-plus-plus/dsa555-peg-jump-solitaire-solver/</link>
		<comments>http://www.zenebo.com/word/c-and-c-plus-plus/dsa555-peg-jump-solitaire-solver/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 17:37:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[C and C++]]></category>

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=6</guid>
		<description><![CDATA[Assignment 1 in DSA555 at Seneca College in Data Structures and Algorithms in C++
Peg solitaire is a game where a set amount of pegs are filled in on a board with a set amount of pegs slots. To solve the Solitaire, a player consecutively jumps a peg over another peg , which in turn is [...]]]></description>
			<content:encoded><![CDATA[<p>Assignment 1 in DSA555 at Seneca College in Data Structures and Algorithms in C++</p>
<p>Peg solitaire is a game where a set amount of pegs are filled in on a board with a set amount of pegs slots. To solve the Solitaire, a player consecutively jumps a peg over another peg , which in turn is emptied out. This process is repeated until there is only one peg on the board.</p>
<p>A C++ program that takes a file name as input . It expects the first line to be in this format:<br />
,<br />
where height and width are valid integers. Using these numbers, it processes the rest of the file using this format:<br />
Character 'O' is an empty peg.<br />
Character 'X' is a taken peg.</p>
<p>Once the board is parsed , if the board has a solution thus has only one peg left , it will print out the consecutive steps to solve it or it will print "No solution" if a solution can't be found .</p>
<p><strong>Instructions</strong></p>
<p>Using command prompt: &lt;executable&gt; &lt;test board&gt;</p>
<p>Boards can be downloaded below the source code download link, or a new board can be created as long as it follows above format.</p>
<p>Zip archive is located here: <a href="http://zenebo.com/solitaire.zip" target="_blank">http://zenebo.com/solitaire.zip</a></p>
<p>Test boards can be downloaded here : <a title="Test vectors" href="http://zenebo.com/solitaire_test_boards.zip" target="_blank">http://zenebo.com/solitaire_test_boards.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/c-and-c-plus-plus/dsa555-peg-jump-solitaire-solver/feed/</wfw:commentRss>
		</item>
		<item>
		<title>You&#8217;ve been served . Setting up a community game server</title>
		<link>http://www.zenebo.com/word/administration_and_development/youve-been-served-setting-up-a-game-server-community/</link>
		<comments>http://www.zenebo.com/word/administration_and_development/youve-been-served-setting-up-a-game-server-community/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 05:33:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Administration and Development]]></category>

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=5</guid>
		<description><![CDATA[On October 9 , 2007 , Valve Software released a long awaited collection of games under an umbrella name called The Orange Box . Titles included in the package are: Half-Life 2, an expansion standalone release named Half-Life 2: Episode One, a continuation of the series titled Half-Life 2: Episode Two, a single-player first-person action/puzzle [...]]]></description>
			<content:encoded><![CDATA[<p>On October 9 , 2007 , Valve Software released a long awaited collection of games under an umbrella name<img class="alignright" style="float: right;" src="http://zenebo.com/images/orange.png" alt="OrangeBox" width="231" height="150" /> called <span style="color: #ff9900;">The Orange Box <span style="color: #000000;">. Titles included in the package are: <strong>Half-Life 2</strong>, an expansion standalone release named <strong>Half-Life 2: Episode One</strong>, a continuation of the series titled <strong>Half-Life 2: Episode Two</strong>, a single-player first-person action/puzzle gem of a game called <strong>Portal</strong> and <strong>Team Fortress 2</strong> .</span></span></p>
<p>As the article name suggests, there is a variety of ways to enjoy the sheer goodness that these games have to offer. A frequent course of action is to set-up an online community. An organized , group centric  approach offers many rewards to the players as well as to game publishers alike . It cultivates fan created content, fosters online discussions, allows for inter-clan or casual leagues to form and most of all keeps the players connected and organized in an otherwise distant field of online gaming.</p>
<p><span style="color: #ff9900;">The Orange Box </span>exploded into a present form of an online juggernaut . Fueled by constant improvements to the underlying Steam platform, players gain ability to form groups , connect with their friends and merge into distinct groups.  Outside of Steam platform, a separate world exists and caters to extend the experience. The dedicated online server communities are the main attraction to more serious gamers . The following paragraphs explain the experience and steps taken to build one of them : <a title="The Last Gunslingers" href="http://tlgs.game-host.org" target="_blank"><strong>The Last Gunslingers</strong></a> , tagged by <strong>[TLGS]</strong> .</p>
<h3><strong>Server Types</strong></h3>
<p>An administrator can choose a pre-installed or a self managed solution . The self managed solution is more flexible, usually more expensive and often more hardware specific to its use. Important things to look for are:</p>
<ul>
<li>Bandwidth</li>
<li>RAM</li>
<li>CPU</li>
<li>Operating System</li>
<li>Network Throughput</li>
</ul>
<p>There could be other factors that can affect the overall performance of the servers , but these are a good start. Let's look at a general overview of the above.</p>
<p><strong>Bandwidth</strong></p>
<p>A game server needs to be able send and receive packets with the least amount of latency. A data center provided 10 Mbit connection can handle one or multiple server instances running on the same physical machine. A Team Fortress 2 server handling 32 connected players will require similar numbers to the ones below .  Server variables that dictate how the server operates may change these dramatically , but overall it is about hitting that performance to price sweet spot .</p>
<p>Rate of data flowing to clients from the server:</p>
<p><strong>2.7 - 3.0 Mbps</strong></p>
<p>This translates to roughly 2.0 - 2.5 Gigabytes of data being sent by the server per hour .</p>
<p>Rate of data flowing to the server from clients:</p>
<p><strong>0.6 - 0.9 Mbps</strong></p>
<p>This translates to roughly 250 Megabytes of data received by the server per hour . These are minimum requirements for a quality sustained connection. A safe practice is to not over saturate the line and leave at least 20% of connection cap free. This will help to eliminate network choke , otherwise known as a network lag .</p>
<p>Summing up possible requirements can be attained by calculating per player / slot network liability .</p>
<p>One player will require on average : 100 Kbps  download and  18 Kbps upload .</p>
<p>A common limiting factor is monthly bandwidth allowance . One full server operating 24 hours a day will push about 900 Gigabytes of traffic per month. Most common server carriers will be able to sustain these transfer speeds as well as data transfers.</p>
<p>Above network usage is based on these server variables:</p>
<p><em> sv_minrate 13000<br />
sv_maxrate 25000<br />
sv_minupdaterate 10<br />
sv_maxupdaterate 33<br />
sv_mincmdrate 10<br />
sv_maxcmdrate 33</em></p>
<p>Next we'll look at the other requirements in the equation such as the CPU and RAM  , etc.</p>
<p>Main website located at <a title="http://orange.half-life2.com/" href="http://orange.half-life2.com/" target="_blank">http://orange.half-life2.com</a> contains more information on the Orange Box compilation.</p>
<p>Wikipedia page is located at <a href="http://en.wikipedia.org/wiki/The_Orange_Box" target="_blank">http://en.wikipedia.org/wiki/The_Orange_Box</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/administration_and_development/youve-been-served-setting-up-a-game-server-community/feed/</wfw:commentRss>
		</item>
		<item>
		<title>OrangeStats - Team Fortress 2 log file parser</title>
		<link>http://www.zenebo.com/word/tools/orangestats-team-fortress-2-log-file-parser/</link>
		<comments>http://www.zenebo.com/word/tools/orangestats-team-fortress-2-log-file-parser/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 05:08:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tools]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=4</guid>
		<description><![CDATA[Orange Stats is a Python script that will parse Team Fortress 2 server log files in order to aggregate the data for later use. Regular expressions capture events as written to the log file by the game server. Each event has a corresponding structure containing various information such as : date , time, victim, aggressor, [...]]]></description>
			<content:encoded><![CDATA[<p>Orange Stats is a Python script that will parse Team Fortress 2 server log files in order to aggregate the data for later use. Regular expressions capture events as written to the log file by the game server. Each event has a corresponding structure containing various information such as : date , time, victim, aggressor, weapon type,  event type and other event specific information. Team Fortress 2 adds a vast array of new gameplay and class specific events which extend the Half-Life 2 log file structure. More information can be obtained from Valve Developer Community <a title="Valve Developer Community" href="http://developer.valvesoftware.com/wiki/SDK_Docs" target="_blank">here</a>.</p>
<p>Orange Stats will insert extracted data into a database for later use by a web front-end or a Team Fortress 2  in-game plugin. The table schema is a bare bones implementation that supports CP map style gameplay. Design requirements focused on simplicity and light weight code implementation. Following game events are captured and categorized :</p>
<ul>
<li>Connect</li>
<li>Disconnect</li>
<li>Map load</li>
<li>Join Team</li>
<li>Point Capture</li>
<li>Point Capture Block</li>
<li>Pick Character Class</li>
<li>Player Death</li>
<li>Player Assist</li>
<li>Revenge</li>
<li>Built Object</li>
<li>Destroy Object</li>
<li>Domination</li>
<li>Steam user events ( user ticket validation )</li>
</ul>
<p>Character class specific data extraction works for events such as:</p>
<ul>
<li>Sapper events, Uber charge events, Engineer object events</li>
</ul>
<p>A web front-end will be uploaded along with the database schema as soon as possible. Orange Stats working demo can be viewed <a title="Orange Stats" href="http://tlgs.game-host.org/stats" target="_blank">here</a> . Web front-end features a slight AJAX touch through <a title="Prototype" href="http://www.prototypejs.org/" target="_blank">PrototypeJS</a> .</p>
<p>Back end runs a light PHP script.</p>
<p>Python script is located <a title="OrangeStats" href="http://zenebo.com/orangestats.zip" target="_self">here</a> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/tools/orangestats-team-fortress-2-log-file-parser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Unreal Tournament 3 resource package explorer!</title>
		<link>http://www.zenebo.com/word/tools/unreal-tournament-3-resource-package-explorer/</link>
		<comments>http://www.zenebo.com/word/tools/unreal-tournament-3-resource-package-explorer/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 00:52:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tools]]></category>

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

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

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

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

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

		<guid isPermaLink="false">http://www.zenebo.com/word/?p=1</guid>
		<description><![CDATA[Upkextract is a very early release of a simple utility that can open and parse the binary .upk packages shipped with Unreal Tournament 3. These packages are designed to be used by the game engine as well as by Unreal Editor. Contents within these archive varies from textures to sounds and shaders.
Current release of Upkextract [...]]]></description>
			<content:encoded><![CDATA[<p>Upkextract is a very early release of a simple utility that can open and parse the binary <em>.upk</em> packages shipped with Unreal Tournament 3. These packages are designed to be used by the game engine as well as by Unreal Editor. Contents within these archive varies from textures to sounds and shaders.</p>
<p>Current release of Upkextract can parse a UT3 resource file and find any sounds contained inside it. Unreal Tournament 3 uses Ogg Vorbis files for sound effects and encodes them using Xiph.org's libVorbis aoTuvb5 library.</p>
<p>Sound file metrics such as gain, channels and others are not extracted in this release.</p>
<p>Archive contains the executable and a sample resource file from UT3.</p>
<p><a title="http://zenebo.com/upkvorbisextract.zip" href="http://zenebo.com/upkvorbisextract.zip" target="_blank">http://zenebo.com/upkvorbisextract.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenebo.com/word/tools/unreal-tournament-3-resource-package-explorer/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
