<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.4" -->
<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/"
	>

<channel>
	<title>Barnoid's Knowledge Base</title>
	<link>http://kb.barnoid.com</link>
	<description>Bits of Collected Wisdom</description>
	<pubDate>Mon, 18 Jan 2010 03:02:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>
	<language>en</language>
			<item>
		<title>Gentoo: Installing Fonts</title>
		<link>http://kb.barnoid.com/?p=29</link>
		<comments>http://kb.barnoid.com/?p=29#comments</comments>
		<pubDate>Mon, 18 Jan 2010 03:00:44 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=29</guid>
		<description><![CDATA[Lots of howtos are out there, here&#8217;s mine:
Install the fonts somewhere in the /usr/share/fonts/ directory. For Type1 fonts (only .pfb and .pfm files are present, but no .afm files), you need to run the type1afm command first to generate the necessary .afm files (otherwise the fonts won&#8217;t show up in OpenOffice, for example). Then generate [...]]]></description>
			<content:encoded><![CDATA[<p>Lots of howtos are out there, here&#8217;s mine:<br />
Install the fonts somewhere in the /usr/share/fonts/ directory. For Type1 fonts (only .pfb and .pfm files are present, but no .afm files), you need to run the type1afm command first to generate the necessary .afm files (otherwise the fonts won&#8217;t show up in OpenOffice, for example). Then generate the font directory and scale files and register the new font directory in the system. In shell-speak:</p>
<pre># cd /usr/share/fonts
# mkdir myfont
# cd myfont
# cp <em>font files, i.e., *.afm *.pfb *.pfm</em> .
# type1afm `ls *.pfb`
# mkfontdir /usr/share/fonts/myfont
# mkfontscale /usr/share/fonts/myfont
# xset fp+ /usr/share/fonts/myfont
# xset fp rehash
# fc-cache</pre>
<p><font> </font><font><font>Check whether the new font shows up in the font list:</font></font></p>
<p><font> </font></p>
<pre><font><font># fc-list | grep -i </font></font></pre>
<p><font> </font><font><font>Done. Restart the application (restarting the X server is not necessary)</font></font>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=29</wfw:commentRSS>
		</item>
		<item>
		<title>1001 reasons why C/C++ is evil</title>
		<link>http://kb.barnoid.com/?p=27</link>
		<comments>http://kb.barnoid.com/?p=27#comments</comments>
		<pubDate>Wed, 05 Nov 2008 02:04:36 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Programming</category>
	<category>C/C++</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=27</guid>
		<description><![CDATA[Consider the following C++ code:
class A
{
int do(string key, bool b)         { cout ]]></description>
			<content:encoded><![CDATA[<p>Consider the following C++ code:</p>
<pre>class A
{
int do(string key, bool b)         { cout << "do('" << key << "', " << (b ? "true" : "false") << ")" << endl; };
int do(string key, string value) { cout << "do('" << key << "', '" << value << "')" << endl; };
};

...

A *a = new A();
a->do(&#8221;do&#8221;, &#8220;something&#8221;);</pre>
<p>What is printed? Well, not what I expected:</p>
<pre># ./reason1
do('do', true)</pre>
<p>Intuitively, the second method, do(string string), should be executed, but gcc (4.1) executes the first method, do(string, bool). This is because the second &#8217;string&#8217;, &#8220;something&#8221;, is interpreted as &#8216;char *&#8217;.</p>
<p>One down, 1000 more reasons to come.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=27</wfw:commentRSS>
		</item>
		<item>
		<title>Ebuild for nslookup / dig?</title>
		<link>http://kb.barnoid.com/?p=26</link>
		<comments>http://kb.barnoid.com/?p=26#comments</comments>
		<pubDate>Wed, 10 Sep 2008 01:44:09 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=26</guid>
		<description><![CDATA[Can&#8217;t find the ebuild containing nslookup or digg? Install the bind-tools:
# emerge -avD net-dns/bind-tools
and you&#8217;re all set:
# nslookup 127.0.0.1

Server:        xxx.yyy.zzz.1
Address:    xxx.yyy.zzz.1#53

1.0.0.127.in-addr.arpa    name = localhost.
]]></description>
			<content:encoded><![CDATA[<p>Can&#8217;t find the ebuild containing nslookup or digg? Install the bind-tools:</p>
<pre># emerge -avD net-dns/bind-tools</pre>
<p>and you&#8217;re all set:</p>
<pre># nslookup 127.0.0.1

Server:        xxx.yyy.zzz.1
Address:    xxx.yyy.zzz.1#53

1.0.0.127.in-addr.arpa    name = localhost.</pre>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=26</wfw:commentRSS>
		</item>
		<item>
		<title>Thunderbird + Lightning: Layout Messed Up?</title>
		<link>http://kb.barnoid.com/?p=25</link>
		<comments>http://kb.barnoid.com/?p=25#comments</comments>
		<pubDate>Mon, 01 Sep 2008 02:39:39 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=25</guid>
		<description><![CDATA[If Thunderbird&#8217;s Lightning calendar extension messes with your Thunderbird layout and doesn&#8217;t work as expected, make sure to install libstdc++5 and then re-install Lightning.
# emerge -av libstdc++
[ebuild  N    ] virtual/libstdc++-3.3

]]></description>
			<content:encoded><![CDATA[<p>If Thunderbird&#8217;s Lightning calendar extension messes with your Thunderbird layout and doesn&#8217;t work as expected, make sure to install libstdc++5 and then re-install Lightning.</p>
<p><code># emerge -av libstdc++</code></p>
<p>[ebuild  N    ] virtual/libstdc++-3.3
</p>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=25</wfw:commentRSS>
		</item>
		<item>
		<title>VIM: Search for selection</title>
		<link>http://kb.barnoid.com/?p=24</link>
		<comments>http://kb.barnoid.com/?p=24#comments</comments>
		<pubDate>Mon, 01 Sep 2008 02:36:07 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
	<category>vi</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=24</guid>
		<description><![CDATA[After yanking a piece of text into the buffer, you can search for it by pressing &#60;ctrl&#62;-&#60;r&#62; &#8221; (that is: control-r double quotes) in search mode (&#8221;/&#8221;).

]]></description>
			<content:encoded><![CDATA[<p>After yanking a piece of text into the buffer, you can search for it by pressing &lt;ctrl&gt;-&lt;r&gt; &#8221; (that is: control-r double quotes) in search mode (&#8221;/&#8221;).
</p>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=24</wfw:commentRSS>
		</item>
		<item>
		<title>VIM  X11 middle-mouse copy/paste</title>
		<link>http://kb.barnoid.com/?p=23</link>
		<comments>http://kb.barnoid.com/?p=23#comments</comments>
		<pubDate>Mon, 01 Sep 2008 02:33:37 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
	<category>vi</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=23</guid>
		<description><![CDATA[That one is easy: just enable the &#8220;vim-with-x&#8221; USE flag and recompile vim:
# echo "app-editors/vim vim-with-x" >> /etc/portage/packages.use

# emerge -av vim

[ebuild   R   ] app-editors/vim-7.2  USE="acl gpm nls perl python vim-with-x -bash-completion -cscope -minimal -ruby -vim-pager&#8221;
]]></description>
			<content:encoded><![CDATA[<p>That one is easy: just enable the &#8220;vim-with-x&#8221; USE flag and recompile vim:</p>
<pre># echo "app-editors/vim vim-with-x" >> /etc/portage/packages.use

# emerge -av vim

[ebuild   R   ] app-editors/vim-7.2  USE="acl gpm nls perl python <strong>vim-with-x</strong> -bash-completion -cscope -minimal -ruby -vim-pager&#8221;</pre>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=23</wfw:commentRSS>
		</item>
		<item>
		<title>Generating a Self-Signed, Unencrypted SSL Certificate</title>
		<link>http://kb.barnoid.com/?p=22</link>
		<comments>http://kb.barnoid.com/?p=22#comments</comments>
		<pubDate>Sun, 20 Apr 2008 03:27:29 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=22</guid>
		<description><![CDATA[Generate an RSA private key:
# openssl genrsa -des3 -out server.key.encrypted 1024
Create a self-signed certificate (make sure to enter the FQDN for the &#8216;Common Name&#8217;)
# openssl req -new -x509 -nodes -sha1 -days 365 -key server.key.encrypted -out server.crt
Remove the password from the encrypted key
# openssl rsa -in server.key.encrypted -out server.key
# chmod 400 server.key
]]></description>
			<content:encoded><![CDATA[<p>Generate an RSA private key:</p>
<pre># openssl genrsa -des3 -out server.key.encrypted 1024</pre>
<p>Create a self-signed certificate (make sure to enter the FQDN for the &#8216;Common Name&#8217;)</p>
<pre># openssl req -new -x509 -nodes -sha1 -days 365 -key server.key.encrypted -out server.crt</pre>
<p>Remove the password from the encrypted key</p>
<pre># openssl rsa -in server.key.encrypted -out server.key
# chmod 400 server.key</pre>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=22</wfw:commentRSS>
		</item>
		<item>
		<title>ALSA Sound Problems (e.g. in Firefox when watching Videos)</title>
		<link>http://kb.barnoid.com/?p=21</link>
		<comments>http://kb.barnoid.com/?p=21#comments</comments>
		<pubDate>Sun, 14 Oct 2007 14:27:22 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=21</guid>
		<description><![CDATA[Recent sound problems (for example no sound when watching Youtube videos in Firefox or Thunderbird crashes whenever it pops up a calendar alarm) are probably caused by missing plugins. ALSA_PCM_PLUGINS controls which plugins are built; by default, it should build all of them, but apparently a recent update does not set the variable.
Symptoms are, for [...]]]></description>
			<content:encoded><![CDATA[<p>Recent sound problems (for example no sound when watching Youtube videos in Firefox or Thunderbird crashes whenever it pops up a calendar alarm) are probably caused by missing plugins. ALSA_PCM_PLUGINS controls which plugins are built; by default, it should build all of them, but apparently a recent update does not set the variable.</p>
<p>Symptoms are, for example, no sound from flash videos within Firefox. When started from a shell various error messages are printed, such as:</p>
<pre>ALSA lib pcm_misc.c:740:(snd_pcm_parse_control_id) Cannot get index for 0
ALSA lib pcm_dmix.c:914:(snd_pcm_dmix_open) unable to open slave
ALSA lib conf.c:3510:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib pcm.c:2144:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib pcm_hw.c:1351:(_snd_pcm_hw_open) Invalid value for card
ALSA lib confmisc.c:769:(parse_card) cannot find card ''</pre>
<p>Try</p>
<pre># echo 'ALSA_PCM_PLUGINS="adpcm alaw copy dshare dsnoop extplug file hooks ladspa lfloat linear meter mulaw multi null rate route share shm"' >> /etc/make.conf
# emerge --oneshot alsa-lib
# /etc/init.d/alsasound restart</pre>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=21</wfw:commentRSS>
		</item>
		<item>
		<title>Concatenate PDF Files</title>
		<link>http://kb.barnoid.com/?p=20</link>
		<comments>http://kb.barnoid.com/?p=20#comments</comments>
		<pubDate>Thu, 28 Jun 2007 08:28:33 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=20</guid>
		<description><![CDATA[To concatenate two or more PDF files together into one, try
# gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=concatenated.pdf file1.pdf file2.pdf [file3.pdf [...]]
With the -dBATCH -dNOPAUSE option, ghostscript won&#8217;t show a prompt and you won&#8217;t have to press  return after each page. Comes in handy if the PDFs are long.

]]></description>
			<content:encoded><![CDATA[<p>To concatenate two or more PDF files together into one, try</p>
<pre># gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=concatenated.pdf file1.pdf file2.pdf [file3.pdf [...]]</pre>
<p>With the -dBATCH -dNOPAUSE option, ghostscript won&#8217;t show a prompt and you won&#8217;t have to press  return after each page. Comes in handy if the PDFs are long.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=20</wfw:commentRSS>
		</item>
		<item>
		<title>CPUFreq Daemon Fails to Stop</title>
		<link>http://kb.barnoid.com/?p=19</link>
		<comments>http://kb.barnoid.com/?p=19#comments</comments>
		<pubDate>Thu, 14 Jun 2007 22:05:36 +0000</pubDate>
		<dc:creator>Barnoid</dc:creator>
		
	<category>Gentoo</category>
	<category>Linux</category>
		<guid isPermaLink="false">http://kb.barnoid.com/?p=19</guid>
		<description><![CDATA[On my Gentoo notebook, stopping cpufreqd fails:
# /etc/init.d/cpufreqd stop
* Stopping CPU Frequency Daemon ...           [ !! ]
It seems that start-stop-daemon fails to terminate the cpufreqd processes, so let&#8217;s help it a bit. Simply add the following bold line to the stop() function in your /etc/init.d/cpufreqd [...]]]></description>
			<content:encoded><![CDATA[<p>On my Gentoo notebook, stopping cpufreqd fails:</p>
<pre># /etc/init.d/cpufreqd stop
* Stopping CPU Frequency Daemon ...           [ !! ]</pre>
<p>It seems that start-stop-daemon fails to terminate the cpufreqd processes, so let&#8217;s help it a bit. Simply add the following <strong>bold</strong> line to the <strong>stop()</strong> function in your /etc/init.d/cpufreqd script</p>
<pre>stop() {
ebegin "Stopping CPU Frequency Daemon"
<strong>kill -9 `ps -A | grep cpufreqd | sort -n | head -n 1 | awk &#8216;{print $1}&#8217;`</strong>
start-stop-daemon &#8211;stop &#8211;exec /usr/sbin/cpufreqd
eend ${?}
}</pre>
<p>Now cpufreqd should shut down nicely:</p>
<pre># /etc/init.d/cpufreqd stop
* Stopping CPU Frequency Daemon ...           [ ok ]</pre>
]]></content:encoded>
			<wfw:commentRSS>http://kb.barnoid.com/?feed=rss2&amp;p=19</wfw:commentRSS>
		</item>
	</channel>
</rss>
