<?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>/dev/blog</title>
	<atom:link href="http://raftaman.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://raftaman.net</link>
	<description>...why bore others needlessly</description>
	<lastBuildDate>Sun, 16 Jun 2013 18:41:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Re-enabling KDE touch pad</title>
		<link>http://raftaman.net/?p=1544</link>
		<comments>http://raftaman.net/?p=1544#comments</comments>
		<pubDate>Mon, 29 Apr 2013 22:14:58 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1544</guid>
		<description><![CDATA[As I wrote in an earlier post, the ambient light button on HP EliteBooks is per default mapped to switch off the touch pad. Since it&#8217;s placed right next to the function keys that increase or decrease the screen brightness, it happens quite often that the key is hit by accident. If you&#8217;re running KDE, [...]]]></description>
				<content:encoded><![CDATA[<p>As I wrote in an <a href="http://raftaman.net/?p=1535">earlier post</a>, the ambient light button on HP EliteBooks is per default mapped to switch off the touch pad. Since it&#8217;s placed right next to the function keys that increase or decrease the screen brightness, it happens quite often that the key is hit by accident.</p>
<p>If you&#8217;re running KDE, hitting <tt>Fn+F11</tt> not only switches off the touch pad. You can&#8217;t even re-enable it with the System Settings manager, since <tt>System Settings -> Input Devices -> Touchpad</tt> manipulates <tt>~/.kde/share/config/kcmtouchpadrc<tt> but the touch pad is disabled in <tt>~/.kde/share/config/ktouchpadenablerrc</tt>.</p>
<p>To re-enable the touch pad, open <strong><tt>~/.kde/share/config/ktouchpadenablerrc</tt></strong> with an editor and change it to</p>
<pre class="brush: plain; title: ; notranslate">
[general]
touchpadEnabled=true
</pre>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1544</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Enabling HP EliteBook ambient light sensor</title>
		<link>http://raftaman.net/?p=1537</link>
		<comments>http://raftaman.net/?p=1537#comments</comments>
		<pubDate>Sun, 21 Apr 2013 00:09:01 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1537</guid>
		<description><![CDATA[To enable the ambient light sensor on an HP EliteBook 8440p or 8460p run To disable:]]></description>
				<content:encoded><![CDATA[<p>To <strong>enable</strong> the ambient light sensor on an HP EliteBook 8440p or 8460p run</p>
<pre class="brush: bash; title: ; notranslate">
# echo 1 &gt; /sys/devices/platform/hp-wmi/als
</pre>
<p>To <strong>disable</strong>:</p>
<pre class="brush: bash; title: ; notranslate">
# echo 0 &gt; /sys/devices/platform/hp-wmi/als
</pre>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1537</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing HP EliteBook ambient button</title>
		<link>http://raftaman.net/?p=1535</link>
		<comments>http://raftaman.net/?p=1535#comments</comments>
		<pubDate>Wed, 10 Apr 2013 00:01:18 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[X]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1535</guid>
		<description><![CDATA[The button that is supposed to toggle the ambient light sensor on HP EliteBooks 8440p and 8460p per default switches off the touch pad. That is because Fn+F11 (scancode 0x33), which is the ambient light button, is incorrectly mapped to KEY_TOUCHPAD_OFF (keycode 193) in kernel. To remap the scancode to another keycode, you can use [...]]]></description>
				<content:encoded><![CDATA[<p>The button that is supposed to toggle the ambient light sensor on HP EliteBooks 8440p and 8460p per default switches off the touch pad. That is because <tt>Fn+F11</tt> (scancode <tt>0x33</tt>), which is the ambient light button, is incorrectly mapped to <tt>KEY_TOUCHPAD_OFF</tt> (keycode 193) in kernel.</p>
<p>To remap the scancode to another keycode, you can use <tt>setkeycodes</tt>. An appropriate choice for a target keycode could be <tt>KEY_PROG1</tt> (<tt>XF86Launch1</tt>, keycode 148) which can be easily reconfigured in KDE or any other desktop environment to run any custom command.</p>
<p>Run the following command as root to remap <tt>Fn+F11</tt> to <tt>KEY_PROG1</tt>:</p>
<pre class="brush: bash; title: ; notranslate">
# setkeycodes e033 148
</pre>
<p>Resources:<br />
<a href="http://www.linlap.com/hp_elitebook_8460p">http://www.linlap.com/hp_elitebook_8460p</a></p>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1535</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C/C++ compound binary logic operations</title>
		<link>http://raftaman.net/?p=1522</link>
		<comments>http://raftaman.net/?p=1522#comments</comments>
		<pubDate>Fri, 22 Mar 2013 01:07:20 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c/c++]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1522</guid>
		<description><![CDATA[I&#8217;ve always had trouble reading and understanding compound binary operations fluently. Whenever they appear in a piece of code, I have to decode them to actually understand what they are doing. This is mainly due to the fact that I infrequently work close to hardware were heavy bit manipulation is a daily occurrence. I won&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve always had trouble reading and understanding compound binary operations fluently. Whenever they appear in a piece of code, I have to decode them to actually understand what they are doing. This is mainly due to the fact that I infrequently work close to hardware were heavy bit manipulation is a daily occurrence. I won&#8217;t bother you with the truth tables of regular bitwise operators,  but here&#8217;s list of combined bit operations that come in quite handy:</p>
<h4>Setting a bit</h4>
<pre class="brush: cpp; title: ; notranslate">
foo |= 0x01;
</pre>
<p>The OR operation is used to set a particular bit that is specified in a BIT MASK. The bit mask is usually specified in hex. In this example it is <tt>0x01</tt> which indicates the first bit.</p>
<h4>Clearing a bit</h4>
<p>To clear bit 0 in <tt>foo</tt>, two different bit operations are required:</p>
<pre class="brush: cpp; title: ; notranslate">
foo &amp;= ~0x01;
</pre>
<p>This example uses the AND and the NOT operator. The NOT operator is used, because most programmers like to specify a mask, wherein the bit that should be changed, is set. You could of course just use a mask, wherein the bits that should be changed are unset, therefore eliminating the requirement for the NOT operator (note that this is highly uncommon though).</p>
<h4>Flipping a bit</h4>
<p>Another very useful tool is the XOR operator:</p>
<pre class="brush: cpp; title: ; notranslate">
foo ^= 0x01;
</pre>
<p>This toggles the first bit, independent of its current state and leaves all other bits unchanged.</p>
<h4>Checking if a bit is set</h4>
<p>Because a statement anything other than zero is considered <tt>TRUE</tt> in C/C++ (and probably every other programming language, too), you can use </p>
<pre class="brush: cpp; title: ; notranslate">
if(foo &amp; 0x01) {
  (...)
}
</pre>
<p>to check, whether the first bit is set or clear. </p>
<h4>Dynamically building a bit mask</h4>
<p>Because it is much easier to specify the bit <tt>number</tt> that should be changed rather than the actual bit <tt>mask</tt>, programmers usually build up the bit mask dynamically. This is done by left-shifting <tt>0x01</tt> n-times. For example, to build a bit mask that has bit number 7 set, you left-shift <tt>0x01</tt> seven times:</p>
<pre class="brush: cpp; title: ; notranslate">
(0x01 &lt;&lt; 7)
</pre>
<p>To build a bit mask that has the first bit (bit number 0) set, you&#8217;d shift <tt>0x01</tt> zero times:</p>
<pre class="brush: cpp; title: ; notranslate">
(0x01 &lt;&lt; 0)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1522</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing PL2303 USB serial adapter as non-root user</title>
		<link>http://raftaman.net/?p=1506</link>
		<comments>http://raftaman.net/?p=1506#comments</comments>
		<pubDate>Fri, 08 Mar 2013 16:14:00 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[udev]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1506</guid>
		<description><![CDATA[If you plug the PL2303 USB to serial adapter (or any other FTDI-like USB adapter) into your USB port, udev creates a /dev/ttyUSBX device with limited read and write permissions (0660 per default). Usually, only the root user and a specific group can access the device at all . To access the device as a [...]]]></description>
				<content:encoded><![CDATA[<p>If you plug the PL2303 USB to serial adapter (or any other FTDI-like USB adapter) into your USB port, <a href="http://en.wikipedia.org/wiki/Udev">udev</a> creates a <tt>/dev/ttyUSBX</tt> device with limited read and write permissions (0660 per default). Usually, only the root user and a specific group can access the device at all . To access the device as a regular user, you can either become a member of that group (distribution specific, <tt>dialout</tt> on fedora) or tell udev to create the device with different read and write permissions.</p>
<h4>Become a member of <tt>dialout</tt></h4>
<p>Simply run</p>
<pre class="brush: bash; title: ; notranslate">
# usermod -a -G groupname username
</pre>
<p>to add the user <tt>username</tt> to the group <tt>groupname</tt>. To verify, that a certain user is a member of a specific group, you can <tt>grep</tt> the file <tt>/etc/group</tt> for a user name</p>
<pre class="brush: bash; title: ; notranslate">
# grep username /etc/group
</pre>
<p>Note that you have to <strong>re-login</strong> for this changes to take effect.</p>
<h4>Create the device with different permissions</h4>
<p><strong>Alternatively</strong>, you can tell udev to create the <tt>/dev/ttyUSBX</tt> device with different read and write permissions. Add a udev rule to <tt>/etc/udev/rules.d/</tt>, e.g. <strong><tt>/etc/udev/rules.d/85-PL2303SerialPort.rules</tt></strong> with the following content:</p>
<pre class="brush: plain; title: ; notranslate">
ATTRS{idVendor}==&quot;067b&quot;, ATTRS{idProduct}==&quot;2303&quot;, MODE=&quot;0666&quot;
</pre>
<p>You can get the vendor and product id from <tt>lsusb</tt> or by looking at <tt>/var/log/messages</tt> when you plug in the device.</p>
<p>After saving the new udev rule, tell udev to reload it&#8217;s ruleset</p>
<pre class="brush: bash; title: ; notranslate">
# udevadm control --reload-rules
</pre>
<p>and <strong>eventually plug in</strong> your adapter.</p>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1506</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to label a partition</title>
		<link>http://raftaman.net/?p=1489</link>
		<comments>http://raftaman.net/?p=1489#comments</comments>
		<pubDate>Tue, 26 Feb 2013 14:16:13 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ext4]]></category>
		<category><![CDATA[Fedora]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1489</guid>
		<description><![CDATA[Labelling a partition can be quite handy, especially for partitions on usb drives that usually get auto-mounted to a folder that corresponds to their label. Usually the label is set when the partition is created. If the label is not explicitly specified, it is usually auto-generated. To change the label, there are a couple of [...]]]></description>
				<content:encoded><![CDATA[<p>Labelling a partition can be quite handy, especially for partitions on usb drives that usually get auto-mounted to a folder that corresponds to their label.</p>
<p>Usually the label is set when the partition is created. If the label is not explicitly specified, it is usually auto-generated. To change the label, there are a couple of tools available:</p>
<h4>ext2/ext3/ext4 partitions</h4>
<p>You can either use <a href="http://linux.about.com/library/cmd/blcmdl8_e2label.htm"><tt>e2label</tt></a></p>
<pre class="brush: bash; title: ; notranslate">
# e2label device [newlabel]
</pre>
<p>or <a href="http://www.cyberciti.biz/faq/linux-partition-howto-set-labels/"><tt>tune2fs</tt></a></p>
<pre class="brush: bash; title: ; notranslate">
# tune2fs -L [newlabel] device
</pre>
<h4>FAT/FAT16/FAT32 partitions</h4>
<p>Again, there are multiple tools available, from simple perl scripts to <a href="http://www.gnu.org/software/mtools/">mtools</a>, but the easiest to use is probably <tt>dosfslabel</tt> from the <a href="http://www.daniel-baumann.ch/software/dosfstools/"><tt>dosfstools</tt> package</a></p>
<pre class="brush: bash; title: ; notranslate">
# yum install dosfstools
[...]
# dosfslabel device [newlabel]
</pre>
<h4>NTFS partitions</h4>
<p><tt>ntfslabel</tt> is available as part of the <a href="http://www.ntfs-3g.org/"><tt>ntfsprogs</tt> package</a></p>
<pre class="brush: bash; title: ; notranslate">
# yum install ntfsprogs
[...]
# ntfslabel device [newlabel]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1489</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inserting arbitrary unicode characters to kwrite</title>
		<link>http://raftaman.net/?p=1477</link>
		<comments>http://raftaman.net/?p=1477#comments</comments>
		<pubDate>Tue, 12 Feb 2013 09:21:05 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1477</guid>
		<description><![CDATA[While you can normally insert arbitrary unicode characters to any X11 application using Ctrl-Shift-u and four hex digits, it doesn&#8217;t work in kwrite or kate. Instead you&#8217;d have to press F7 to switch to command line and type in For example, to get the degree symbol (Unicode: U+00B0) you&#8217;d type in 'char 176' (176 being [...]]]></description>
				<content:encoded><![CDATA[<p>While you can normally <a href="http://en.wikipedia.org/wiki/Unicode_input">insert arbitrary unicode characters</a> to any X11 application using Ctrl-Shift-u and four hex digits, it doesn&#8217;t work in kwrite or kate. Instead you&#8217;d have to <strong>press F7</strong> to switch to command line and type in </p>
<pre class="brush: plain; title: ; notranslate">
char &lt;unicode&gt;
</pre>
<p>For example, to get the degree symbol (Unicode: U+00B0) you&#8217;d type in <tt>'char 176'</tt> (176 being 0xB0 converted do decimal).</p>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1477</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search for a package containing a certain file</title>
		<link>http://raftaman.net/?p=1469</link>
		<comments>http://raftaman.net/?p=1469#comments</comments>
		<pubDate>Wed, 30 Jan 2013 04:36:04 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1469</guid>
		<description><![CDATA[Assumed you want to find the package that contains the shared object libGLU.so.1, e.g. because a binary is dynamically linked against it, and ldd tells you that the shared library requirements are not met. On Fedora (or any yum-type os) you&#8217;d run and yum would tell you, that mesa-libGLU comes with /usr/lib64/libGLU.so.1 which could fulfill [...]]]></description>
				<content:encoded><![CDATA[<p>Assumed you want to find the package that contains the shared object <strong><tt>libGLU.so.1</tt></strong>, e.g. because a binary is dynamically linked against it, and <tt>ldd</tt> tells you that the shared library requirements are not met. On <strong>Fedora</strong> (or any yum-type os) you&#8217;d run</p>
<pre class="brush: bash; title: ; notranslate">
$ yum whatprovides */libGLU.so.1
</pre>
<p>and yum would tell you, that <tt>mesa-libGLU</tt> comes with <tt>/usr/lib64/libGLU.so.1</tt> which could fulfill your need (could because you could also be missing the i686 version of the package, depending on your binary).</p>
<p>The <strong>Ubuntu</strong> way of achieving the same thing:</p>
<pre class="brush: bash; title: ; notranslate">
$ apt-file search libGLU.so.1
</pre>
<p>And of course the corresponding package would be <tt>libglu1-mesa</tt> on any recent Ubuntu os.</p>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1469</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the default displaymanager in Fedora 18</title>
		<link>http://raftaman.net/?p=1491</link>
		<comments>http://raftaman.net/?p=1491#comments</comments>
		<pubDate>Mon, 21 Jan 2013 05:21:09 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1491</guid>
		<description><![CDATA[With the release of Fedora 18, there have been some changes to the /etc/sysconfig directory. For example, switching the default display manager is no longer done by altering parameters in /etc/sysconfig/desktop but via Therefore, to switch from the default gdm to kdm you&#8217;d run:]]></description>
				<content:encoded><![CDATA[<p>With the release of Fedora 18, there have been <a href="http://docs.fedoraproject.org/en-US/Fedora/18/html/Release_Notes/sect-Release_Notes-Changes_for_Sysadmin.html">some changes</a> to the <tt>/etc/sysconfig</tt> directory. For example, <a href="http://docs.fedoraproject.org/en-US/Fedora/18/html/Release_Notes/sect-Release_Notes-Changes_for_Desktop.html">switching the default display manager</a> is no longer done by altering parameters in <strong><tt>/etc/sysconfig/desktop</tt></strong> but via</p>
<pre class="brush: bash; title: ; notranslate">
# systemctl enable --force displaymanager.service 
</pre>
<p>Therefore, to switch from the default <tt>gdm</tt> to <strong><tt>kdm</tt></strong> you&#8217;d run:</p>
<pre class="brush: bash; title: ; notranslate">
# systemctl enable --force kdm.service 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1491</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to send a client&#8217;s hostname to the DHCP server</title>
		<link>http://raftaman.net/?p=1377</link>
		<comments>http://raftaman.net/?p=1377#comments</comments>
		<pubDate>Sat, 05 Jan 2013 03:31:50 +0000</pubDate>
		<dc:creator>RaftaMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[Fedora]]></category>

		<guid isPermaLink="false">http://raftaman.net/?p=1377</guid>
		<description><![CDATA[In contrast to Ubuntu (or even Microsoft Windows) default installations of Fedora do not send the client&#8217;s hostname to the DHCP server. To change this behaviour, add a DHCP_HOSTNAME variable to your /etc/sysconfig/network-scripts/ifcfg-eth0 file (eth0 being your NIC&#8217;s interface name): Of course, this only works if you actually get your IP address via DHCP (since [...]]]></description>
				<content:encoded><![CDATA[<p>In contrast to Ubuntu (or even Microsoft Windows) default installations of Fedora do not send the client&#8217;s hostname to the DHCP server.</p>
<p>To change this behaviour, add a <strong><tt>DHCP_HOSTNAME</tt></strong> variable to your <strong><tt>/etc/sysconfig/network-scripts/ifcfg-eth0</tt></strong> file (<tt>eth0</tt> being your NIC&#8217;s interface name):</p>
<pre class="brush: plain; highlight: [5]; title: ; notranslate">
UUID=&quot;616426f3-ac0b-4a4a-9221-62a0055bfb07&quot;
NM_CONTROLLED=&quot;yes&quot;
NETBOOT=&quot;yes&quot;
BOOTPROTO=&quot;dhcp&quot;
DHCP_HOSTNAME=&quot;MyFedoraBox&quot;
DEVICE=&quot;eth0&quot;
TYPE=&quot;Ethernet&quot;
ONBOOT=yes
NAME=&quot;DHCP&quot;
HWADDR=00:25:22:4A:3F:F2
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
USERS=user
</pre>
<p>Of course, this only works if you actually get your IP address via DHCP (since the DHCP server hands off the hostname to the DNS server). If you use a static IP configuration, <tt>nsupdate</tt> can be used to dynamically update the DNS server records. Examples and instructions on how to use <tt>nsupdate</tt> can be found at <a href="http://linux.yyz.us/nsupdate/">http://linux.yyz.us/nsupdate/</a> or <a href="http://dijks.wordpress.com/2012/07/17/register-a-hostnames-static-ip-with-your-corporate-dns-server/">http://dijks.wordpress.com/2012/07/17/register-a-hostnames-static-ip-with-your-corporate-dns-server/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://raftaman.net/?feed=rss2&#038;p=1377</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
