<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Andreas Bernauer's personal blog (Entries tagged as computer science)</title>
    <link>http://www.lysium.de/blog/</link>
    <description>come around</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.3 - http://www.s9y.org/</generator>
    <pubDate>Mon, 30 Nov 2009 07:53:52 GMT</pubDate>

    <image>
        <url>http://www.lysium.de/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Andreas Bernauer's personal blog - come around</title>
        <link>http://www.lysium.de/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Plotting data with gnuplot in real-time</title>
    <link>http://www.lysium.de/blog/index.php?/archives/234-Plotting-data-with-gnuplot-in-real-time.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/234-Plotting-data-with-gnuplot-in-real-time.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=234</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=234</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I needed to plot data from a program in real-time for a demo, that is, as the program generates the data, I wanted it to show in some nice diagram.&lt;/p&gt;

&lt;p&gt;A friend pointed me to &lt;a href=&quot;http://users.softlab.ece.ntua.gr/~ttsiod/gnuplotStreaming.html&quot;&gt;Visualize real-time data streams with Gnuplot&lt;/a&gt; by &lt;a href=&quot;http://users.softlab.ece.ntua.gr/~ttsiod/&quot;&gt;Thanassis Tsiodras&lt;/a&gt;, which is very nice: you specify the number of streams to plot and where to plot them, and feed it with lines like &#039;0:1.23&#039;, &#039;1:2.3&#039;, etc. defining the data points for the individual streams (here: first point on stream 0 is 1.23, first point on stream 1 is 2.3, etc.).&lt;/p&gt;

&lt;p&gt;However, I needed to plot several streams in a single window, which that version lacked. So I extended that program with the ability to plot several streams into a single window (&lt;a href=&quot;http://www.lysium.de/sw/driveGnuPlotStreams.pl&quot;&gt;download&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;For this, you specify both the number of streams you want to plot and the number of windows you want to show. Furthermore, you specify in which window each stream is plotted. I kept as much as possible of the original command line interface to ease the transition to this new version. The result looks like this:&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/234-Plotting-data-with-gnuplot-in-real-time.html#extended&quot;&gt;Continue reading &quot;Plotting data with gnuplot in real-time&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 29 Nov 2009 19:21:32 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/234-guid.html</guid>
    <category>computer science</category>
<category>gnuplot</category>
<category>plotting</category>
<category>video</category>

</item>
<item>
    <title>g++ error message: 'non-class type'</title>
    <link>http://www.lysium.de/blog/index.php?/archives/232-g++-error-message-non-class-type.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/232-g++-error-message-non-class-type.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=232</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=232</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;Who&#039;s designing the error messages of g++? Anyways, here is a translation:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;error: request for member ‘foo’ in ‘((Test*)this)-&amp;gt;Test::_bar’, 
which is of non-class type ‘C_bar*’
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;means: in class &lt;code&gt;Test&lt;/code&gt;, you&#039;ve written &lt;code&gt;_bar.foo&lt;/code&gt;, but &lt;code&gt;_bar&lt;/code&gt; is a pointer; you need to write &lt;code&gt;_bar-&amp;gt;foo&lt;/code&gt;, that is, change the dot to an arrow.&lt;/p&gt;

&lt;p&gt;Happy C++ coding!&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Fri, 30 Jan 2009 10:08:00 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/232-guid.html</guid>
    <category>c++</category>
<category>computer science</category>
<category>knowledgebase</category>
<category>programming</category>

</item>
<item>
    <title>Global and local variables in python</title>
    <link>http://www.lysium.de/blog/index.php?/archives/231-Global-and-local-variables-in-python.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/231-Global-and-local-variables-in-python.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=231</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=231</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I just stumbled over my python code, similar to the following one, which raises an UnboundLocalError in the first line of &lt;code&gt;push&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;def func_stack1():
    stack = []
    def push(num):
        print &quot;stack before: &quot;, stack
        stack = stack + [num]
        print &quot;stack after: &quot;, stack
    return push

push = func_stack1()
push(1)
&lt;/code&gt;&lt;/pre&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/231-Global-and-local-variables-in-python.html#extended&quot;&gt;Continue reading &quot;Global and local variables in python&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 27 Jan 2009 15:08:30 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/231-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>
<category>python</category>

</item>
<item>
    <title>Installing Python 2.6 on Ubuntu 8.04</title>
    <link>http://www.lysium.de/blog/index.php?/archives/229-Installing-Python-2.6-on-Ubuntu-8.04.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/229-Installing-Python-2.6-on-Ubuntu-8.04.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=229</wfw:comment>

    <slash:comments>20</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=229</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I wanted to &#039;upgrade&#039; my python from 2.5 to 2.6 on Ubuntu. Unfortunately, I could not find .deb packages for Ubuntu. Fortunately, the &lt;a href=&quot;http://www.python.org/ftp/python/2.6/Python-2.6.tgz&quot;&gt;Python 2.6 sources&lt;/a&gt; &lt;a href=&quot;http://www.python.org/download/releases/2.6/Python-2.6.tgz.asc&quot;&gt;(sig)&lt;/a&gt; are available, so I can compile it from source. Here&#039;s what I had to do to get it running. (Short version: &lt;code&gt;apt-get build-dep python2.5&lt;/code&gt; and apply &lt;a href=&quot;/sw/python2.6-disable-old-modules.patch&quot;&gt;this patch&lt;/a&gt; to disable unavailable and outdated modules.)&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/229-Installing-Python-2.6-on-Ubuntu-8.04.html#extended&quot;&gt;Continue reading &quot;Installing Python 2.6 on Ubuntu 8.04&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 06 Nov 2008 14:06:37 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/229-guid.html</guid>
    <category>computer science</category>
<category>howto</category>
<category>knowledgebase</category>
<category>python</category>

</item>
<item>
    <title>gvim spell correction popup menu</title>
    <link>http://www.lysium.de/blog/index.php?/archives/224-gvim-spell-correction-popup-menu.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/224-gvim-spell-correction-popup-menu.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=224</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=224</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I gvim, if you set&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:setlocal spell spelllang=en_us
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;gvim will spell-check your file and underline wrongly spelled words with a red line much like you know it from OpenOffice. If  you&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:set mousemodel=popup
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you can even right click on any misspelled word to get a list of suggested corrections.&lt;/p&gt;

&lt;p&gt;However, this sometimes did not work for me.  I could not figure out a reason, until I read the help docs again, which clearly say:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Note for GTK: don&#039;t release the right mouse button until the menu appears, 
otherwise it won&#039;t work.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;They actually mean what they say: if I release the right mouse button too fast, the menu appears, but it does not replace the misspelled word with the corrected word.  Only if keep the right mouse pressed until the menu appears, it works, for whatever reason. RTFM!&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sat, 17 May 2008 16:01:00 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/224-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>

</item>
<item>
    <title>Lost static objects in static libraries with GNU linker `ld`</title>
    <link>http://www.lysium.de/blog/index.php?/archives/222-Lost-static-objects-in-static-libraries-with-GNU-linker-ld.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/222-Lost-static-objects-in-static-libraries-with-GNU-linker-ld.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=222</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=222</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;If you link a static library to your executable, the GNU linker &lt;code&gt;ld&lt;/code&gt; (as many others) only adds those symbols that &lt;code&gt;ld&lt;/code&gt; thinks are actually used in your executable (that&#039;s a feature). Unfortunately, &lt;code&gt;ld&lt;/code&gt; can only check if the symbol is in use, but not if the side effects of the symbol&#039;s initialization is used. Thus, your program will fail if it depends on the initialization of an unused static object.&lt;/p&gt;

&lt;p&gt;In my case, I have a factory (&lt;code&gt;class module::factory&amp;lt;T&amp;gt; : public factory_plant {...} factory;&lt;/code&gt;) at which classes can register themselves with a name (&lt;code&gt;module::factory&amp;lt;Group&amp;gt; f(&quot;Group&quot;)&lt;/code&gt;). If I call the factory with a name (&lt;code&gt;factory.create(&quot;Group&quot;)&lt;/code&gt;), the factory returns a pointer to a newly created class associated with that name. The class registers itself via a static object (here: &lt;code&gt;f&lt;/code&gt;) whose initialization code does the actual registration.&lt;/p&gt;

&lt;p&gt;The problem arises if the class is not used directly and the linker throws the static object away. The registration does not happen and thus I can&#039;t use the factory to create an object of the class. There are several possibilities to work around this feature:&lt;/p&gt;

&lt;p&gt;Use &lt;code&gt;--whole-archive&lt;/code&gt; to tell the linker to include all symbols, no matter what (with &lt;code&gt;gcc&lt;/code&gt; use &lt;code&gt;-Wl,--whole-archive -lmylib -Wl,--no-whole-archive&lt;/code&gt;).  The drawback is that symbols that I neither use nor care about are also included, resulting in increased code size.&lt;/p&gt;

&lt;p&gt;Use &lt;code&gt;-u&amp;lt;symbol&amp;gt;&lt;/code&gt; to tell the linker to treat &lt;code&gt;&amp;lt;symbol&amp;gt;&lt;/code&gt; as if undefined and thus include it in the executable, even it is not used. The drawback here is to know what &lt;code&gt;&amp;lt;symbol&amp;gt;&lt;/code&gt; looks like. Easy for C files, difficult (and not portable) for C++ files (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Name_mangling&quot;&gt;Name mangling in Wikipedia&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Use static initializers (thanks to &lt;a href=&quot;http://blog.copton.net/&quot;&gt;Alex&lt;/a&gt; for this).  This is my preferred method. I use a throw-away class, which I add to the header file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;static struct Init {
     Init() {
          static module::factory&amp;lt;Group&amp;gt; init(&quot;Group&quot;);
     }
} init;
&lt;/code&gt;&lt;/pre&gt;
 
    </content:encoded>

    <pubDate>Tue, 06 May 2008 18:30:00 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/222-guid.html</guid>
    <category>c</category>
<category>c++</category>
<category>computer science</category>
<category>knowledgebase</category>

</item>
<item>
    <title>TinyCC -- a fast C compiler</title>
    <link>http://www.lysium.de/blog/index.php?/archives/207-TinyCC-a-fast-C-compiler.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/207-TinyCC-a-fast-C-compiler.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=207</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=207</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I&#039;ve just found a nice, small C compiler: &lt;a href=&quot;http://fabrice.bellard.free.fr/tcc/&quot;&gt;tinycc&lt;/a&gt;. The compiler includes the actual compiler and the linker, so you don&#039;t need other external tools. The executable is only 122KB in size on my system (Fedora Core 6). I like &lt;code&gt;tcc&lt;/code&gt; because it allows you to create &lt;em&gt;C-scripts&lt;/em&gt;.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/207-TinyCC-a-fast-C-compiler.html#extended&quot;&gt;Continue reading &quot;TinyCC -- a fast C compiler&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 14 Dec 2007 20:23:30 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/207-guid.html</guid>
    <category>c</category>
<category>computer science</category>
<category>programming</category>

</item>
<item>
    <title>Restricting access to directories and files in Apache's httpd</title>
    <link>http://www.lysium.de/blog/index.php?/archives/205-Restricting-access-to-directories-and-files-in-Apaches-httpd.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/205-Restricting-access-to-directories-and-files-in-Apaches-httpd.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=205</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=205</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I always have to look it up how to restrict access to some files or directories on my web server, so I write it down here.  Two steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You need a password file&lt;/li&gt;
&lt;li&gt;You must specify the restrictions&lt;/li&gt;
&lt;/ol&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/205-Restricting-access-to-directories-and-files-in-Apaches-httpd.html#extended&quot;&gt;Continue reading &quot;Restricting access to directories and files in Apache&#039;s httpd&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 13 Dec 2007 17:57:10 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/205-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>

</item>
<item>
    <title>Low-Cost Multi-touch Whiteboard using the Wii Remote</title>
    <link>http://www.lysium.de/blog/index.php?/archives/200-Low-Cost-Multi-touch-Whiteboard-using-the-Wii-Remote.html</link>
            <category>computer science</category>
            <category>net</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/200-Low-Cost-Multi-touch-Whiteboard-using-the-Wii-Remote.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=200</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=200</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;That&#039;s really cool: Johnny Lee uses the Wii remote to create a &lt;a href=&quot;http://www.youtube.com/watch?v=5s5EvhHy7eQ&quot;&gt;low-cost multi-touch screen&lt;/a&gt;, either on a whiteboard or your laptop or any other surface you like. You can even download his software at &lt;a href=&quot;http://www.johnnylee.net&quot;&gt;his homepage&lt;/a&gt;. That&#039;s great, check it out!&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Wed, 12 Dec 2007 11:08:09 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/200-guid.html</guid>
    <category>computer science</category>
<category>net</category>
<category>video</category>

</item>
<item>
    <title>How to get ssh server fingerprint information</title>
    <link>http://www.lysium.de/blog/index.php?/archives/186-How-to-get-ssh-server-fingerprint-information.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/186-How-to-get-ssh-server-fingerprint-information.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=186</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=186</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;When you connect to a host that you have not connected to before via ssh, ssh prints a message like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;lava:~$ ssh lava
The authenticity of host &#039;lava (134.2.14.48)&#039; can&#039;t be established.
RSA key fingerprint is 9e:1a:5e:27:16:4d:2a:13:90:2c:64:41:bd:25:fd:35.
Are you sure you want to continue connecting (yes/no)?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Usually, you say &lt;code&gt;yes&lt;/code&gt; and enter your password. With this, you accept the encryption key the server sent you as the actual encryption key of the server (as opposed to an encryption key some eavesdropper might have sent you who sits between you and the server you connect to). You are supposed to accept the encryption key only if you compared the received encryption key with the actual encryption key of the server by comparing their fingerprints. However, how do you get the fingerprint of the actual encryption key?&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/186-How-to-get-ssh-server-fingerprint-information.html#extended&quot;&gt;Continue reading &quot;How to get ssh server fingerprint information&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 25 Nov 2007 12:49:14 +0100</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/186-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>

</item>
<item>
    <title>Gcc inline assembler howto summary</title>
    <link>http://www.lysium.de/blog/index.php?/archives/135-Gcc-inline-assembler-howto-summary.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/135-Gcc-inline-assembler-howto-summary.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=135</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=135</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;I found the &lt;a href=&quot;http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html&quot;&gt;Howto on the gcc inline
assembler&lt;/a&gt;
difficult to understand, so I wrote up the major parts here and
created some kind of summary.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.lysium.de/blog/index.php?/archives/135-Gcc-inline-assembler-howto-summary.html#extended&quot;&gt;Continue reading &quot;Gcc inline assembler howto summary&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 14 Aug 2007 14:33:22 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/135-guid.html</guid>
    <category>computer science</category>
<category>howto</category>
<category>knowledgebase</category>
<category>programming</category>

</item>
<item>
    <title>selinux warning: &quot;Multiple same specifications for ...&quot;</title>
    <link>http://www.lysium.de/blog/index.php?/archives/95-selinux-warning-Multiple-same-specifications-for-....html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/95-selinux-warning-Multiple-same-specifications-for-....html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=95</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=95</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;On my machine running Fedora 7, I saw message like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/etc/selinux/targeted/contexts/files/file_contexts: 
  Multiple same specifications for /usr/local/lost\+found/.*.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;for some files or directories, especially when doing an &lt;code&gt;yum update&lt;/code&gt; or running &lt;code&gt;rpm&lt;/code&gt;.  I checked the &lt;code&gt;file_contexts&lt;/code&gt; file, but I could not find any duplicates.&lt;/p&gt;

&lt;p&gt;The solutions was some stale &lt;code&gt;file_contexts.pre&lt;/code&gt; file in the same directory, which was a copy of &lt;code&gt;file_contexts&lt;/code&gt; with some modifications.  After deleting the &lt;code&gt;file_contexts.pre&lt;/code&gt; file, the messages disappeared.&lt;/p&gt;

&lt;p&gt;I&#039;m still wondering, where this &lt;code&gt;file_contexts.pre&lt;/code&gt; file came from, as it did not belong to any package.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Fri, 29 Jun 2007 18:46:51 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/95-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>
<category>selinux</category>

</item>
<item>
    <title>cfengine: &quot;destination type is silly&quot;</title>
    <link>http://www.lysium.de/blog/index.php?/archives/93-cfengine-destination-type-is-silly.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/93-cfengine-destination-type-is-silly.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=93</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=93</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;Writing meaningful error message is sometimes hard.  Even harder is understanding error message of someone else&#039;s program. Today I was buffeled with an error message from cfengine:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cfengine:lava: image exists but destination type 
               is silly (file/dir/link doesn&#039;t match)
cfengine:lava: source=/afs/wsi/wsi/environment/fedora/6/cfengine/
               config/ti-background.png,dest=/usr/share/pixmaps
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;How can a destination type be silly? And what file/dir/link does not match?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.google.com/codesearch?hl=en&amp;amp;q=+file:image.c+package:http://gentoo.osuosl.org/distfiles/cfengine-2.1.22.tar.gz+silly+show:Ngj25Jsg1EU:bPaCuWV4piY:ptqLVqwZBfE&amp;amp;sa=N&amp;amp;cd=1&amp;amp;ct=rc&amp;amp;cs_p=http://gentoo.osuosl.org/distfiles/cfengine-2.1.22.tar.gz&amp;amp;cs_f=cfengine-2.1.22/src/image.c#a2&quot;&gt;Looking into the sources&lt;/a&gt; (see second match) revealed that the destination type refers to the type of &lt;code&gt;dest&lt;/code&gt;, that is &lt;code&gt;/usr/share/pixmaps&lt;/code&gt;, which is a directory. This type does not match the type of the source &lt;code&gt;/afs/wsi/.../ti-background.png&lt;/code&gt;, which is a regular file.&lt;/p&gt;

&lt;p&gt;So the solution to the problem is explicitly naming the target file in the cfengine configuration files:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;dest=/usr/share/pixmaps/ti-background.png
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I wish the error message from cfengine would be a bit more verbose on this. But now I know what the error message means, and so do you.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 18 Jun 2007 15:15:55 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/93-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>

</item>
<item>
    <title>Hints on writing (bash) shell scripts</title>
    <link>http://www.lysium.de/blog/index.php?/archives/87-Hints-on-writing-bash-shell-scripts.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/87-Hints-on-writing-bash-shell-scripts.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=87</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=87</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;Today a small hint that can save you a lot of debugging time when writing shell scripts. If you start your (bash) shell script with&lt;br /&gt;
&lt;code&gt;set -u -e&lt;/code&gt;&lt;br /&gt;
unset parameters won&#039;t expand to nothing (&lt;code&gt;-u&lt;/code&gt;) and the script ends immediately when one command fails (&lt;code&gt;-e&lt;/code&gt;) unless it is part of a test (&lt;code&gt;if&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt;, &lt;code&gt;||&lt;/code&gt;, etc., see &lt;a href=&quot;http://www.gnu.org/software/bash/manual/bashref.html#SEC58&quot;&gt;bash(1)&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you want to debug your shell script, you either insert echo commands throught your script, or you can just insert&lt;br /&gt;
&lt;code&gt;set -v -x&lt;/code&gt;&lt;br /&gt;
at the top.  This will turn on verbose mode (&lt;code&gt;-v&lt;/code&gt;) in which bash will print the input lines as they are read. The execution trace (&lt;code&gt;-x&lt;/code&gt;) mode will print the commands after expansion but before execution, so you can check if the command is invoked the way you intended.&lt;/p&gt;

&lt;p&gt;I thought about posting similar hints for &lt;code&gt;tcsh&lt;/code&gt;, but &lt;a href=&quot;http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/&quot;&gt;who is&lt;/a&gt; &lt;a href=&quot;http://www.grymoire.com/Unix/CshTop10.txt&quot;&gt;shell scripting in &lt;code&gt;tcsh&lt;/code&gt;&lt;/a&gt; anyways?&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Fri, 08 Jun 2007 10:00:17 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/87-guid.html</guid>
    <category>computer science</category>
<category>knowledgebase</category>
<category>programming</category>

</item>
<item>
    <title>Recursive ldd</title>
    <link>http://www.lysium.de/blog/index.php?/archives/35-Recursive-ldd.html</link>
            <category>computer science</category>
    
    <comments>http://www.lysium.de/blog/index.php?/archives/35-Recursive-ldd.html#comments</comments>
    <wfw:comment>http://www.lysium.de/blog/wfwcomment.php?cid=35</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lysium.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=35</wfw:commentRss>
    

    <author>nospam@example.com (Andreas Bernauer)</author>
    <content:encoded>
    &lt;p&gt;Yesterday, Dario Lesca &lt;a href=&quot;http://www.redhat.com/archives/fedora-list/2007-May/msg01656.html&quot;&gt;asked for a recursive ldd&lt;/a&gt; on the &lt;a href=&quot;http://www.redhat.com/archives/fedora-list/&quot;&gt;fedora mailing list&lt;/a&gt;. I see two possibilities:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extend the ldd script to accept an &#039;-r&#039; option and search for dynamic libraries recursively.&lt;/li&gt;
&lt;li&gt;Write a script that reads in the output from ldd and recalls ldd to resolve the dependencies.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I opted for the second approach (ever tried to shell script platform-independently?). You can find the resulting &lt;a href=&quot;http://www.lysium.de/sw/ldd-rec.pl&quot;&gt;ldd-rec.pl&lt;/a&gt; script here.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 17 May 2007 23:41:00 +0200</pubDate>
    <guid isPermaLink="false">http://www.lysium.de/blog/index.php?/archives/35-guid.html</guid>
    <category>computer science</category>

</item>

</channel>
</rss>