<?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>In Nomine - The Lotus Land &#187; Programming</title>
	<atom:link href="http://www.in-nomine.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.in-nomine.org</link>
	<description>The focused mind can pierce through stone...</description>
	<lastBuildDate>Sat, 19 Jun 2010 17:59:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Predefined macros</title>
		<link>http://www.in-nomine.org/2010/04/11/predefined-macros/</link>
		<comments>http://www.in-nomine.org/2010/04/11/predefined-macros/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 16:05:51 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++ compiler]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[preprocessor]]></category>
		<category><![CDATA[visual c++]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=534</guid>
		<description><![CDATA[So with the GNU compiler you can use the preprocessor to get a list of the predefined macros: $ cpp -dM /dev/null or if you prefer to invoke the preprocessor via gcc itself: $ gcc -dM -E - &#60; /dev/null This should give you a list similar like: #define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define [...]]]></description>
			<content:encoded><![CDATA[<p>So with the GNU compiler you can use the preprocessor to get a list of the predefined macros:</p>
<pre class="brush: bash;">
$ cpp -dM /dev/null
</pre>
<p>or if you prefer to invoke the preprocessor via gcc itself:</p>
<pre class="brush: bash;">
$ gcc -dM -E - &lt; /dev/null
</pre>
<p>This should give you a list similar like:</p>
<pre class="brush: cpp;">
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __DEC64_DEN__ 0.000000000000001E-383DD
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647
</pre>
<p>For Microsoft&#8217;s Visual C++ compiler I have only found pages like:</p>
<ul>
<li><a title="Predefined Macros" href="http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.80%29.aspx">Visual Studio 2005 predefined macros</a></li>
<li><a title="Predefined Macros" href="http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.90%29.aspx">Visual Studio 2008 predefined macros</a></li>
<li><a title="Predefined Macros" href="http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.100%29.aspx">Visual Studio 2010 predefined macros</a></li>
</ul>
<p>For Intel&#8217;s C++ compiler I found the <a title="Additional predefined macros" href="http://www.intel.com/software/products/compilers/clin/docs/main_cls/mergedProjects/cref_cls/linux/lin1077.htm">following page with predefined macros</a>.</p>
<p>And I find this <a title="Pre-defined Compiler Macros" href="http://predef.sourceforge.net/precomp.html">interesting page with a lot of different compilers and their predefined macros</a> to identify them and their versions, if any.</p>
<p>Edit: I also found how to do this with <a title="clang: a C language family frontend for LLVM" href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;ved=0CAoQFjAA&amp;url=http%3A%2F%2Fclang.llvm.org%2F&amp;ei=y_nBS8CqAeWJOOiylJcE&amp;usg=AFQjCNErQyy6jy8CJ7ROQw4f8nH22kuaSA&amp;sig2=w6gehcV5JBNsBe9jOe-C6g">Clang</a>:</p>
<pre class="brush: bash;">
$ clang -dD -E - &lt; /dev/null
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2010/04/11/predefined-macros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL 3.x and DirectX 10/11</title>
		<link>http://www.in-nomine.org/2010/01/18/opengl-3-x-and-directx-1011/</link>
		<comments>http://www.in-nomine.org/2010/01/18/opengl-3-x-and-directx-1011/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 10:30:06 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[directx]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=512</guid>
		<description><![CDATA[Expect more information about OpenGL and DirectX related subjects in the coming period as I will start to delve into the basics of these.]]></description>
			<content:encoded><![CDATA[<p>Expect more information about OpenGL and DirectX related subjects in the coming period as I will start to delve into the basics of these.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2010/01/18/opengl-3-x-and-directx-1011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trac and Mylyn integration</title>
		<link>http://www.in-nomine.org/2009/09/25/trac-and-mylyn-integration/</link>
		<comments>http://www.in-nomine.org/2009/09/25/trac-and-mylyn-integration/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 13:08:36 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[accountmanager]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[httpauth]]></category>
		<category><![CDATA[mod_wsgi]]></category>
		<category><![CDATA[mylyn]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=343</guid>
		<description><![CDATA[At work we use Jira for some projects, but the projects I work on use Trac. For many projects an environment like Trac is sufficient. Recently I started to use Eclipse with Pydev for the Python development. Eclipse features a plugin called Mylyn, which allows you to configure a task repository and directly access the [...]]]></description>
			<content:encoded><![CDATA[<p>At work we use <a title="Jira" href="http://www.atlassian.com/software/jira/">Jira</a> for some projects, but the projects I work on use <a title="Trac" href="http://trac.edgewall.org/">Trac</a>. For many projects an environment like Trac is sufficient. Recently I started to use <a title="Eclipse" href="http://www.eclipse.org/">Eclipse</a> with <a title="Pydev" href="http://pydev.org/">Pydev</a> for the Python development. Eclipse features a plugin called Mylyn, which allows you to configure a task repository and directly access the tasks in that repository. This is extremely useful, since the repository can also be an instance of Jira or Trac. To connect Mylyn to these repositories you will need a so-called connector. For Jira there&#8217;s the <a title="Atlassian Connector for Eclipse" href="http://confluence.atlassian.com/display/IDEPLUGIN/Atlassian+Connector+for+Eclipse">Atlassian Connector for Eclipse</a> and for Trac the standard Eclipse repository already has a <code>Mylyn Connector: Trac</code> available. Make sure this is installed.</p>
<p>Next, we need to install some plugins for Trac. On my setup we use <a title="AccountManagerPlugin" href="http://trac-hacks.org/wiki/AccountManagerPlugin">AccountManager</a> for authentication and managing of the password files. To make Mylyn talk with Trac we need to add the <a title="Trac XML-RPC Plugin" href="http://trac-hacks.org/wiki/XmlRpcPlugin">XML-RPC</a> as well as the <a title="HttpAuth plugin" href="http://trac-hacks.org/wiki/HttpAuthPlugin">HTTPAuth</a> plugin. The XML-RPC plugin is the one that provides XML-RPC methods for Mylyn to talk with Trac. The HTTPAuth plugin is needed if your Trac&#8217;s login has been replaced by AccountManager (as is the typical way to use it). HTTPAuth forces certain URL paths (<code>/xmlrpc, /login/xmlrpc</code>) to use standard authentication.</p>
<p>A typical trac.ini will look like this after enabling the appropriate plugins:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>account-manager<span style="">&#93;</span></span>
<span style="color: #000099;">password_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /usr/local/projects/project1/svn-auth</span>
<span style="color: #000099;">password_store</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> HtPasswdStore</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>components<span style="">&#93;</span></span>
acct_mgr.admin.accountmanageradminpage <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> enabled</span>
acct_mgr.api.accountmanager <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> enabled</span>
acct_mgr.htfile.htpasswdstore <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> enabled</span>
acct_mgr.web_ui.accountmodule <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> enabled</span>
acct_mgr.web_ui.loginmodule <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> enabled</span>
acct_mgr.web_ui.registrationmodule <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> disabled</span>
httpauth.* <span style="color: #000066; font-weight:bold;">=</span> enabled
trac.web.auth.loginmodule <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> disabled</span>
tracrpc.* <span style="color: #000066; font-weight:bold;">=</span> enabled
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>httpauth<span style="">&#93;</span></span>
<span style="color: #000099;">paths</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /xmlrpc, /login/xmlrpc</span></pre></div></div>

<p>After restarting Apache (with mod_wsgi, of course), if you go to <code>http://trac.example.com/project1/xmlrpc</code> it should present you with a user/password prompt. But most likely this will keep repeating without authorising you. After a bit of head scratching and looking around I found out that that is because mod_wsgi requires to pass authorization through to the WSGI application by means of <code>WSGIPassAuthorization On</code> in the appropriate Apache configuration file.</p>
<p>After all this works, you can configure a new Mylyn repository within Eclipse (<code>Windows &gt; Show View &gt; Other &gt; Tasks &gt; Task Repositories</code>). If you then click the icon that stands for create new repository it will present you with a configuration window for adding new repositories. Select the <code>Trac</code> option, followed by <code>Next</code>. In the <code>Server</code> field you can just add <code>http://trac.example.com/project1</code>, followed by a, for you, descriptive <code>Label</code> for this repository. The <code>User ID</code> and <code>Password</code> are those you use to log into the Trac instance. Under <code>Additional Settings</code> is an option for selecting the <code>Access Type</code>, make sure you select <code>XML-RPC</code> here. Ensure that <code>Task Editor Settings</code> has <code>TracWiki</code> selected. Now, by selecting <code>Validate Settings</code>, you ought to see a message stating &#8220;<code>Authentication credentials are valid</code>&#8221; at the top of the window.</p>
<p>That&#8217;s it. You can now follow the <a title="Mylyn User Guide" href="http://wiki.eclipse.org/index.php/Mylyn_User_Guide">Mylyn User Guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2009/09/25/trac-and-mylyn-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>docutils: ImportError: No module named roman</title>
		<link>http://www.in-nomine.org/2009/04/07/docutils-importerror-no-module-named-roman/</link>
		<comments>http://www.in-nomine.org/2009/04/07/docutils-importerror-no-module-named-roman/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 08:22:14 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[docutils]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=278</guid>
		<description><![CDATA[For some reason setup.py can fail with docutils complaining it cannot find the roman module. One thing that works is just removing docutils from your site-packages and reinstall it.]]></description>
			<content:encoded><![CDATA[<p>For some reason setup.py can fail with docutils complaining it cannot find the roman module. One thing that works is just removing docutils from your site-packages and reinstall it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2009/04/07/docutils-importerror-no-module-named-roman/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSONP with Werkzeug</title>
		<link>http://www.in-nomine.org/2009/04/03/jsonp-with-werkzeug/</link>
		<comments>http://www.in-nomine.org/2009/04/03/jsonp-with-werkzeug/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 13:07:15 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonp]]></category>
		<category><![CDATA[werkzeug]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=269</guid>
		<description><![CDATA[So I had implemented a simple JSON data server with Werkzeug for a classroom experiment. Unfortunately in my haste to get everything up and running I totally forgot about the fact that, since we cannot allow uploads to this server of various custom made webpages, using jQuery&#8217;s $.ajax() everything just fails since it will then [...]]]></description>
			<content:encoded><![CDATA[<p>So I had implemented a simple <a title="JSON data format website" href="http://www.json.org/">JSON</a> data server with Werkzeug for a classroom experiment. Unfortunately in my haste to get everything up and running I totally forgot about the fact that, since we cannot allow uploads to this server of various custom made webpages, using <a title="Ajax/jQuery.ajax() documentation" href="http://docs.jquery.com/Ajax/jQuery.ajax">jQuery&#8217;s <code>$.ajax()</code></a> everything just fails since it will then be a cross-site scripting request.</p>
<p>So, normally you would do something like the following in order to return JSON data:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">return</span> json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span></pre></div></div>

<p>Which would be used with the $.ajax() call in a way like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>
  url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://example.com/json/something&quot;</span><span style="color: #339933;">,</span>
  data<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;parameter=value&quot;</span><span style="color: #339933;">,</span>
  dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;json&quot;</span><span style="color: #339933;">,</span>
  error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>XMLHttpRequest<span style="color: #339933;">,</span> textStatus<span style="color: #339933;">,</span> errorThrown<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #339933;">,</span> msg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Which is perfectly fine for scripts getting and using the data on the same host/domain. But, as said before, this will fail with warnings similar to: <code>"Access to restricted URI denied" code: "1012" nsresult: "0xdeadc0de (NS_ERROR_DOM_BAD_URI)"</code>.</p>
<p>One way out of this is using <a title="Remote JSON - JSONP" href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/">JSONP</a>. jQuery has a <a title="Ajax/jQuery.getJSON() documentation" href="http://docs.jquery.com/Ajax/jQuery.getJSON"><code>$.getJSON()</code> function</a>, which loads JSON data using a HTTP GET request. Now, the simplistic way to convert your code would be to change it as such:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://example.com/json/something&quot;</span><span style="color: #339933;">,</span>
  <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>But this causes another issue. Since <code>$.getJSON()</code> GETs the JSON data, but doesn&#8217;t use eval() on it, but instead pulls the result into <code>script</code> tags, it somehow causes,on Firefox at least, an invalid label error. In order to fix this you need to set up the JSON data server to properly support a callback argument, to use <code>$.getJSON()</code> how it is meant to be used:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://example.com/json/something?jsoncallback=?&quot;</span><span style="color: #339933;">,</span>
  <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In the code above the additional parameter <code>jsoncallback</code> will, thanks to jQuery, get the question mark replaced by an alphanumeric string (typically in the form of <code>jsonp</code> followed by a timestamp). This value should be used to wrap the resulting JSON data with. This means you would have to change the initial Python code to something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">return</span> request.<span style="color: black;">args</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'jsoncallback'</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'('</span> + json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">')'</span></pre></div></div>

<p>Of course this causes problems when you want to reuse the code for both AJAX use on the same host/domain and use it from outside. So in order to make both work you can test on whether or not the callback parameter is available and return the appropriate data. I came up with this little snippet for that:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> jsonwrapper<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, request, data<span style="color: black;">&#41;</span>:
    callback = request.<span style="color: black;">args</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'jsoncallback'</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> callback:
        <span style="color: #ff7700;font-weight:bold;">return</span> callback + <span style="color: #483d8b;">'('</span> + json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">')'</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2009/04/03/jsonp-with-werkzeug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sendfile() mishandling</title>
		<link>http://www.in-nomine.org/2009/02/25/sendfile-mishandling/</link>
		<comments>http://www.in-nomine.org/2009/02/25/sendfile-mishandling/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 11:49:31 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[sendfile]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=264</guid>
		<description><![CDATA[As I said in http://www.in-nomine.org/2009/02/22/tinymce-in-wordpress-271-not-working-on-freebsd/ I had problems making TinyMCE work. After some digging I discovered that the tiny_mce.js file was being oddly truncated and repeated when fetched. Subsequent tests showed that md5 hashes differed every single time with the original file. During these fetch tests my kernel crashed twice in the network stack. Since [...]]]></description>
			<content:encoded><![CDATA[<p>As I said in http://www.in-nomine.org/2009/02/22/tinymce-in-wordpress-271-not-working-on-freebsd/ I had problems making TinyMCE work.</p>
<p>After some digging I discovered that the tiny_mce.js file was being oddly truncated and repeated when fetched. Subsequent tests showed that md5 hashes differed every single time with the original file.</p>
<p>During these fetch tests my kernel crashed twice in the network stack. Since my lighttpd configuration uses kqueue and the likes I suspected that perhaps something was not right in lighttpd 1.4.21, which was only released a couple of days ago. So I downgraded to 1.4.20. &#8216;Lo and behold, the problems disappeared. To be absolutely sure, I recompiled lighttpd 1.4.21 as well. And at first it seemed to work, but then the corruption kicked in again. After talking about it on the #lighttpd channel on FreeNode I found out it was a problem with <a title="Bug 1913: not fully serving data" href="http://redmine.lighttpd.net/issues/1913">lighttpd 1.4.21&#8242;s handling of sendfile() on FreeBSD</a>.</p>
<p>The fix is now also in the lighttpd port of FreeBSD, so other people should not encounter this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2009/02/25/sendfile-mishandling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TinyMCE in WordPress 2.7.1 not working on FreeBSD?</title>
		<link>http://www.in-nomine.org/2009/02/22/tinymce-in-wordpress-271-not-working-on-freebsd/</link>
		<comments>http://www.in-nomine.org/2009/02/22/tinymce-in-wordpress-271-not-working-on-freebsd/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 11:44:18 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=260</guid>
		<description><![CDATA[Discovered today that with both Firefox 3.0 and Opera 9.63 on FreeBSD, TinyMCE within WordPress 2.7.1 is not allowing me to use the visual editing mode. I tried the example of TinyMCE and it works without problems. Based on this and the fact it works on Windows, there must be something weird in either WordPress [...]]]></description>
			<content:encoded><![CDATA[<p>Discovered today that with both Firefox 3.0 and Opera 9.63 on FreeBSD, TinyMCE within <a href="http://www.wordpress.org/">WordPress</a> 2.7.1 is not allowing me to use the visual editing mode. I tried the <a href="http://tinymce.moxiecode.com/examples/full.php">example of TinyMCE</a> and it works without problems. Based on this and the fact it works on Windows, there must be something weird in either WordPress or its included version of TinyMCE with FreeBSD. I <a href="http://wordpress.org/support/topic/246349">logged a post</a> over at the WordPress forums.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2009/02/22/tinymce-in-wordpress-271-not-working-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>25-year old readdir() bug fixed</title>
		<link>http://www.in-nomine.org/2008/05/09/25-year-old-readdir-bug-fixed/</link>
		<comments>http://www.in-nomine.org/2008/05/09/25-year-old-readdir-bug-fixed/#comments</comments>
		<pubDate>Fri, 09 May 2008 10:30:59 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[netbsd]]></category>
		<category><![CDATA[openbsd]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=240</guid>
		<description><![CDATA[Marc Balmer (of the OpenBSD Project) investigated reports of weird filesystem behaviour and found a 25-year old bug in the BSD libc implementation of readdir(). The fix should be in the trunk of all BSDs now and scheduled for merges or backports soon (e.g. see http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/readdir.c revision 1.15&#8242;s diff).]]></description>
			<content:encoded><![CDATA[<p>Marc Balmer (of the <a title="OpenBSD" href="http://www.openbsd.org/">OpenBSD Project</a>) <a title="When seekdir() Won't Seek to the Right Position " href="http://www.vnode.ch/fixing_seekdir">investigated reports of weird filesystem behaviour and found a 25-year old bug</a> in the BSD libc implementation of readdir().</p>
<p>The fix should be in the trunk of all BSDs now and scheduled for merges or backports soon (e.g. see <a href="http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/readdir.c">http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/readdir.c</a> revision 1.15&#8242;s diff).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2008/05/09/25-year-old-readdir-bug-fixed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSH ControlMaster and Subversion</title>
		<link>http://www.in-nomine.org/2008/04/13/openssh-controlmaster-and-subversion/</link>
		<comments>http://www.in-nomine.org/2008/04/13/openssh-controlmaster-and-subversion/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 10:14:34 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=231</guid>
		<description><![CDATA[OpenSSH has a fantastic feature called ControlMaster. Basically this option allows you to create a socket that will share your already opened ssh session to the same host. To enable this option for all you put the following snippet in your $HOME/.ssh/config after creating something like $HOME/.ssh/sockets: Host * ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h:%p For every [...]]]></description>
			<content:encoded><![CDATA[<p>OpenSSH has a fantastic feature called ControlMaster. Basically this option allows you to create a socket that will share your already opened ssh session to the same host. To enable this option for all you put the following snippet in your <code>$HOME/.ssh/config</code> after creating something like <code>$HOME/.ssh/sockets</code>:</p>
<pre>Host *
  ControlMaster auto
  ControlPath ~/.ssh/sockets/%r@%h:%p</pre>
<p>For every username@host:port it will create a socket in <code>$HOME/.ssh/sockets</code>. The only problem is that current Subversion (1.4.6 on my FreeBSD box) cannot work well with control sockets when using the svn+ssh:// URI identifier. In order to work around this problem you can add a specific host before the wildcard entry, for example:</p>
<pre>Host svn.example.com
  ControlMaster no

Host *
  ControlMaster auto
  ControlPath ~/.ssh/sockets/%r@%h:%p</pre>
<p>Of course, doing it like this is a bit tedious for every Subversion repository you use in this manner. Thankfully there is another way to do this. In <code>$HOME/.subversion/config</code> there is a section called <code>[tunnels]</code>. If you add the following entry to that section it will disable the ControlMaster:</p>
<pre>[tunnels]
ssh = ssh -o ControlMaster=no</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2008/04/13/openssh-controlmaster-and-subversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python 2.6 compiler options results</title>
		<link>http://www.in-nomine.org/2008/04/12/python-26-compiler-options-results/</link>
		<comments>http://www.in-nomine.org/2008/04/12/python-26-compiler-options-results/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 17:10:56 +0000</pubDate>
		<dc:creator>asmodai</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[edward tufte]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[python 2.6]]></category>

		<guid isPermaLink="false">http://www.in-nomine.org/?p=227</guid>
		<description><![CDATA[So after yesterday&#8217;s post about some compiler results with Python 2.6 I wanted to show how some of GCC&#8217;s architecture-specific compiler flags affect the execution of pybench. As I explained in comments I think most people will never even touch the flags passed to Python&#8217;s build. Nonetheless, some people asked if I had tuned it [...]]]></description>
			<content:encoded><![CDATA[<p>So after yesterday&#8217;s post about some compiler results with Python 2.6 I wanted to show how some of GCC&#8217;s architecture-specific compiler flags affect the execution of pybench. As I explained in comments I think most people will never even touch the flags passed to Python&#8217;s build. Nonetheless, some people asked if I had tuned it in any way. <a title="Pádraig Brady's homepage" href="http://www.pixelbeat.org/">Pádraig Brady</a> <a href="http://www.in-nomine.org/2008/04/11/python-26a2-execution-times-with-various-compilers/#comment-3813">had asked me</a> if I had used the optimal GCC architecture flags. On my FreeBSD 7.0-STABLE machine at home (AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ (2411.13-MHz K8-class CPU)) <a title="GCC CPU opt script" href="http://www.pixelbeat.org/scripts/gcccpuopt">his script</a> stated I had to pass along &#8220;-m32 -march=k8 -mfpmath=sse&#8221;. My machine is fully 64 bits so I left out the -m32 (since it will not link anyway) and used &#8220;-march=k8 -mfpmath=sse&#8221; (using -march=native instead of k8 resulted in a 0,1 seconds faster result and -mtune=native -march=native instead of k8 resulted in a 0,1 &#8211; 0,2 seconds faster result).</p>
<p>The default option flags are on my system: -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes.</p>
<p>Considering some other comments about how I did not use a 0-origin for my y-axis I have to point out two things: firstly, given the sometimes close results zooming out too much can eliminate detailed information (of course you have to be careful not to zoom in too much as well); secondly, I like to make sure the graph itself is appropriately centered so you do not get a whitespace skewing in the resulting image. I think, being a follower of the <a title="Edward Tufte's homepage" href="http://www.edwardtufte.com/">Edward Tufte</a> school of graphic displaying, I did reasonably well. The graphs were made with a tool called <a title="Ploticus homepage" href="http://ploticus.sourceforge.net/">Ploticus</a>.</p>
<p><a href="http://www.in-nomine.org/wp-content/uploads/2008/04/gcc421def-march.png"><img class="aligncenter size-full wp-image-228" style="vertical-align: middle;" title="gcc421def-march" src="http://www.in-nomine.org/wp-content/uploads/2008/04/gcc421def-march.png" alt="GCC 4.2.1 default and architecture options" width="557" height="357" /></a></p>
<p>I was curious how the optimization level influenced the resulting program and as such I removed the -O3 option from the compiler flags. As is evident from the graph you are looking at a bit more than a doubling of execution time (an average of 14,2 seconds versus the previous 6,6 and 6,5 seconds).</p>
<p><a href="http://www.in-nomine.org/wp-content/uploads/2008/04/gcc421def-march-noo3.png"><img class="aligncenter size-full wp-image-229" style="vertical-align: middle;" title="gcc421def-march-noo3" src="http://www.in-nomine.org/wp-content/uploads/2008/04/gcc421def-march-noo3.png" alt="GCC 4.2.1 with no O3" width="557" height="374" /></a></p>
<p>So, given the huge performance hit by merely leaving out the -O3, I was interested how the other optimization levels worked out. <a href="http://www.in-nomine.org/2008/04/11/python-26a2-execution-times-with-various-compilers/#comment-3820">Holger Hoffstätte asked to use -O2 -fomit-frame-pointer</a> instead of -O3. Basically the results of -O3 (average of 6,5 seconds) and -O2 -fomit-frame-pointer (average of 6,5 seconds) were equal. The result of using -O1 (I could not really discern much of a speed difference by adding -fomit-frame-pointer, also for the -O2 case it was still an average of 6,5 seconds) was quite interesting. It already improves execution by ~86%. From -O1 to -O2/-O3 we are looking at another increase of ~16%. From the no optimization case to -O2/-O3 execution improves by ~118%</p>
<p><a href="http://www.in-nomine.org/wp-content/uploads/2008/04/gcc421options.png"><img class="aligncenter size-full wp-image-230" style="vertical-align: middle;" title="gcc421options" src="http://www.in-nomine.org/wp-content/uploads/2008/04/gcc421options.png" alt="GCC 4.2.1 with various options" width="557" height="391" /></a></p>
<p>I tried a profile-guided optimization build, but I have some issues on my FreeBSD 7.0-STABLE with libgcov. Apparently only a libgconv.a is provided and linking gives me a relocation warning. Thankfully I also had a GCC 4.2.4 snapshot from March installed and did a PGO build, but I managed to only shave of about 0,2 seconds on the average time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.in-nomine.org/2008/04/12/python-26-compiler-options-results/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
