<?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>Elfstone &#187; Programming</title>
	<atom:link href="http://elfstone.nl/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://elfstone.nl</link>
	<description>Don't believe the hype</description>
	<lastBuildDate>Sun, 06 May 2012 14:13:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Debian packages: debugging postinst</title>
		<link>http://elfstone.nl/2010/06/02/debian-packages-debugging-postinst/</link>
		<comments>http://elfstone.nl/2010/06/02/debian-packages-debugging-postinst/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 12:37:16 +0000</pubDate>
		<dc:creator>michiel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://elfstone.nl/?p=348</guid>
		<description><![CDATA[When writing debian packages, sometimes things go wrong in the postinst stage. An error like &#8220;the postinstallation script returned an error code of 1&#8243; will occur. This is not very informative. If you want to debug postinst scripts, you can &#8230; <a href="http://elfstone.nl/2010/06/02/debian-packages-debugging-postinst/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When writing debian packages, sometimes things go wrong in the postinst stage. An error like &#8220;the postinstallation script returned an error code of 1&#8243; will occur. This is not very informative.</p>
<p>If you want to debug postinst scripts, you can easily do this on the machine where you (half) installed the package. Normally you can execute /var/lib/dpkg/info/foo.postinst like this:<br />
<code><br />
sh -x /var/lib/dpkg/info/foo.postinst configure<br />
</code></p>
<p>However, if you use debconf, the output will be like this:<br />
<code>+ . /usr/share/debconf/confmodule<br />
+ [ !  ]<br />
+ PERL_DL_NONLAZY=1<br />
+ export PERL_DL_NONLAZY<br />
+ [  ]<br />
+ exec /usr/share/debconf/frontend /var/lib/dpkg/info/foo.postinst<br />
</code></p>
<p>Which is not helpful either. However, you can add &#8220;set -x&#8221; in /var/lib/dpkg/info/foo.postinst and then just execute it, it will give you the full output.</p>
<p><code><br />
sh /var/lib/dpkg/info/foo.postinst configure<br />
</code></p>
<p>Now the debugging process can begin!</p>
]]></content:encoded>
			<wfw:commentRss>http://elfstone.nl/2010/06/02/debian-packages-debugging-postinst/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian packaging: multiple packages</title>
		<link>http://elfstone.nl/2009/11/25/debian-packaging-multiple-packages/</link>
		<comments>http://elfstone.nl/2009/11/25/debian-packaging-multiple-packages/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 12:08:52 +0000</pubDate>
		<dc:creator>michiel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://elfstone.nl/?p=224</guid>
		<description><![CDATA[For different projects, I&#8217;ve made debian packages before, but I&#8217;ve never had a project where multiple packages were created from one control file. Today, I had to work on a project where I had to do this. Everything went as &#8230; <a href="http://elfstone.nl/2009/11/25/debian-packaging-multiple-packages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For different projects, I&#8217;ve made debian packages before, but I&#8217;ve never had a project where multiple packages were created from one control file. Today, I had to work on a project where I had to do this. Everything went as normal, except that I could not find out where to install the files so dh_builddeb could include them in their respective packages.</p>
<p>When only one package is made, this is easy: just install the files in debian/tmp as you would when installing on the system. For multiple packages, each package has its own directory: debian/&lt;package-name&gt;. How does dh_builddeb figure out which directory to use?</p>
<p><strong>Apparently, the default behaviour is to let the first package use the debian/tmp dir, and the other packages use the debian/&lt;package-name&gt; directory.<br />
</strong></p>
<p>I would rather have them all using the debian/&lt;package-name&gt; directory, but I could not find an option to do this.</p>
<p><em>Update:</em><br />
It seems that setting the compatibility level to 7 fixes this behaviour (echo &#8220;7&#8243; &gt; debian/compat), see man debhelper (section &#8220;Compatibility levels&#8221; for more info.</p>
]]></content:encoded>
			<wfw:commentRss>http://elfstone.nl/2009/11/25/debian-packaging-multiple-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X disk I/O</title>
		<link>http://elfstone.nl/2008/06/02/os-x-disk-io/</link>
		<comments>http://elfstone.nl/2008/06/02/os-x-disk-io/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 21:40:26 +0000</pubDate>
		<dc:creator>michiel</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://elfstone.nl/?p=47</guid>
		<description><![CDATA[Today I encountered something odd. While working on an assignment for my study I noticed that a program was running very slow (using only 30% CPU). This program makes a training set of a set of images, so a lot &#8230; <a href="http://elfstone.nl/2008/06/02/os-x-disk-io/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I encountered something odd. While working on an assignment for my study I noticed that a program was running very slow (using only 30% CPU). This program makes a training set of a set of images, so a lot of I/O is involved. The weird thing is, when calling the training program in a different way, it was using over 70% CPU (and finished in a shorter amount of time).</p>
<p>Looking at Activity Monitor, a lot of I/O was done, both reading (1-2 MB/s) and writing (0.5 MB/s). I expected reading, but writing? The change in calling the training program was the the filenames it should read. In the fast case, it was reading all filenames, to train on all data. in the slower case it was reading a somewhat smaller subset of these files, to train for K-fold cross-validation.</p>
<p>The thing is, the somewhat smaller subset was generated by picking random filenames, so it was unsorted. This caused the trainer to read files non-sequentially (while the order doesn&#8217;t really matter). Apparently, this caused a lot of load in writing the <strong>access times</strong> of the accessed filenames. Because the directory has 14380 filenames, a non-sequential update of the access times apparently is not very nice on disk I/O.</p>
<p>Sorting the smaller subset on filename caused the trainer to have a CPU usage of over 70% and an appropriate shorter run time as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://elfstone.nl/2008/06/02/os-x-disk-io/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ack</title>
		<link>http://elfstone.nl/2008/03/18/ack/</link>
		<comments>http://elfstone.nl/2008/03/18/ack/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 12:53:37 +0000</pubDate>
		<dc:creator>michiel</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://elfstone.nl/2008/03/18/ack/</guid>
		<description><![CDATA[Someone recommended a tool to me: ack (ack-grep in debian). It can be used to recursively find words (like grep) but ignoring .svn directories and adding hilights. Highly recommended!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webdevel.nl/">Someone</a> recommended a tool to me: <a href="http://petdance.com/ack/">ack</a> (ack-grep in debian). It can be used to recursively find words (like grep) but ignoring .svn directories and adding hilights. Highly recommended!</p>
]]></content:encoded>
			<wfw:commentRss>http://elfstone.nl/2008/03/18/ack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX response times</title>
		<link>http://elfstone.nl/2008/02/29/ajax-response-times/</link>
		<comments>http://elfstone.nl/2008/02/29/ajax-response-times/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 17:06:18 +0000</pubDate>
		<dc:creator>michiel</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://elfstone.nl/2008/02/29/ajax-response-times/</guid>
		<description><![CDATA[While developing an web-application using AJAX and python, I found that in some cases the interface was slow. Debugging (using FF and firebug) showed that for one action three AJAX request were made. The response times in this specific situation &#8230; <a href="http://elfstone.nl/2008/02/29/ajax-response-times/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While developing an web-application using AJAX and python, I found that in some cases the interface was slow. Debugging (using FF and firebug) showed that for one action three AJAX request were made. The response times in this specific situation were: user/group list: 130-150ms (each), getpermissions: 160-180ms.</p>
<p>This was on a local test-server, so there was almost no latency. Testing the same site when I was remote, the response times were around 600-800ms for each call (I don&#8217;t know the exact numbers now). Since each request has a certain startup-time, and since we are still using CGI instead of mod_python (for debugging purposes) it seems reasonable to assume that the startup-time is high, relative to executing time. That&#8217;s why I tried combining the three requests into one.</p>
<p>What I did is adding optional arguments to the getpermissions call. If these arguments are present, it also returns the corresponding list. Testing response times with this changed code resulted in the same response times. So far so good.</p>
<p>Testing the code with the combined call resulted in a 160-180ms response time. This is exactly the same for the getpermissions call without querying the lists! Apparently the CGI has a very high impact, and the list generating code very low impact.</p>
<p>All in all this resulted in a 260-300ms improvement, on my local testing network! This is noticeably faster. I&#8217;m glad :)</p>
]]></content:encoded>
			<wfw:commentRss>http://elfstone.nl/2008/02/29/ajax-response-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exceptions in C++</title>
		<link>http://elfstone.nl/2006/06/11/exceptions-in-c/</link>
		<comments>http://elfstone.nl/2006/06/11/exceptions-in-c/#comments</comments>
		<pubDate>Sun, 11 Jun 2006 21:21:02 +0000</pubDate>
		<dc:creator>michiel</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://elfstone.nl/2006/06/11/exceptions-in-c/</guid>
		<description><![CDATA[Are exceptions slower than constructions with &#8216;return&#8217;? Yes, exceptions are slower, just a bit. Test setup The test-program first wastes some CPU time in a recursive function and using a loop. This is to simulate a real-time CPU-intensive task which has deeply &#8230; <a href="http://elfstone.nl/2006/06/11/exceptions-in-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>Are exceptions slower than constructions with &#8216;return&#8217;?</h3>
<p><span class="Apple-style-span" style="font-size: 16px; font-weight: normal">Yes, exceptions are slower, just a bit.</span><br />
<h4>Test setup</h4>
<p>The <a href="http://elfstone.nl/uploads/2008/02/exceptions.cc" title="test-program">test-program</a> first wastes some CPU time in a recursive function and using a loop. This is to simulate a real-time CPU-intensive task which has deeply nested functions. This process runs twice, first with high values of looping and recursing and another time with no looping and no recursing. Then the program prints the time spent and the ratio between throwing/nonthrowing functions on both runs.<br />
<h4>Results</h4>
<p>Typical output of the program:
<pre>ratio throwing/nonthrowing: 3.09256e+06ms / 3.07183e+06ms = 1.00675</pre>
<pre>ratio throwing/nonthrowing: 3ms / 3ms = 1</pre>
<p>Normally, the program doesn&#8217;t throw, but does try to catch exceptions because we want to know the performance of the situation where nothing goes wrong. If something does go wrong (and an exception is thrown) the following output may be observed:
<pre>ratio throwing/nonthrowing: 3.16843e+06ms / 3.16829e+06ms = 1.00005</pre>
<pre>ratio throwing/nonthrowing: 42ms / 3ms = 14</pre>
<h4>Conclusions</h4>
<p>Apparently, actually throwing an exception does cost some time, but when everything is ok the performance is a tiny bit slower: about 0.65%, calculated from the <a href="http://elfstone.nl/uploads/2008/02/results.txt" title="test run">test run</a>.<br />
<h4>Notes</h4>
<p>The program was compiled and tested on an Athlon 900Mhz, with the following command:
<p class="quote">g++ -o exceptions exceptions.cc -O3</p>
<p>Apologies for the ugly code :)</p>
]]></content:encoded>
			<wfw:commentRss>http://elfstone.nl/2006/06/11/exceptions-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

