<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>anti</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/" />
   <link rel="self" type="application/atom+xml" href="http://anti.teamidiot.de/atom.xml" />
   <id>tag:anti.teamidiot.de,2010://1</id>
   <updated>2010-07-17T21:10:02Z</updated>
   <subtitle>privat bei reichen Eltern — anti@conference.jabber.teamidiot.de</subtitle>
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.38 mod_perl/2</generator>

<entry>
   <title>Multiseat hacks (gnome gdm)</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/07/multiseat_hacks_gnome_gdm/" />
   <id>tag:anti.teamidiot.de,2010://1.155</id>
   
   <published>2010-07-08T21:33:04Z</published>
   <updated>2010-07-17T21:10:02Z</updated>
   
   <summary>I have two screens connected to a powerful box. Mostly, I&amp;#8217;m using these for coding and it&amp;#8217;s running Xinerama with radeon (sssh don&amp;#8217;t say anything). Only sometimes however, I would like to share the machine with a second user. There...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="360" label="evdev" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="356" label="gdm" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="362" label="gdmflexiserver" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="36" label="gnome" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="2" label="keyboard" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="359" label="multi-user-x" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="357" label="multiseat" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="218" label="opensuse" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="361" label="xdmcp" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="353" label="Xephyr" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="343" label="xkb" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="355" label="Xnest" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>I have two screens connected to a powerful box. Mostly, I&#8217;m using these for coding and it&#8217;s running Xinerama with radeon (sssh don&#8217;t say anything).</p>

<p>Only sometimes however, I would like to share the machine with a second user.</p>

<p>There are several recommended ways for multiseat setup:</p>


<ul>
<li>Configure the Xserver with seperate screens (not Xinerama). Start Xephyr/Xnest on each screen</li>
<li>Start two seperate Xserver (this requires seperate graphic cards or <strong>maybe</strong> <a href="http://airlied.livejournal.com/72187.html">this patch</a> which I couldn&#8217;t get to work)</li>
</ul>



<p>Furthermore, you need to fiddle with the login manager to do everything &#8220;right&#8221;.</p>

<p>As my setup is more temporary, I opted for a middle way. It remains not without rough edged though&#8230; The main login remains running on two screens, and in the case of wanting to share, I will set up a Xephyr instance on one monitor. </p>

<p>Because of Xinerama, Xephyr doesn&#8217;t work out of the box like that. So I chose a small hack: I open an empty xterm (which has the netwm ability to go to fullscreen) and embed the Xephyr in it:</p>

<pre><code>uxterm -title Xephyr +sb -hold -e ''</code></pre>

<p>move the xterm window to the second monitor and switch it to fullscreen&#8230; I am using Gnome and have assigned a keybinding for that. That way, Xephyr will be running &#8220;full screen&#8221; on just one monitor, something that it isn&#8217;t able to do on its own (Xephyrs fullscreen would expand over both monitors due to Xinerama)</p>

<p>Now we need to start the Xephyr and allow the login for the other account. Again, we have two possibilities. One is to use the xdmcp mode of gdm, and another to use gdmflexiserver &#8212; the Gnome user switcher.</p>

<p><b>Update:</b> I can&#8217;t get the <span class="caps">SCIM </span>input method editor to work with xdmcp&#8230; anyone knows why? So I&#8217;ve resorted to the gdmflexiserver one for now.</p>

<p>For the xdmcp, we need to enable it. For example, in SuSE, set <code>DISPLAYMANAGER_REMOTE_ACCESS=&quot;yes&quot;</code> in <code>/etc/sysconfig/displaymanager</code>. Then it is enough to use a wrapper script. For access to the input devices, root permission is required though.</p>

<p>For the gdmflexiserver approach on the other hand, it is necessary to replace <code>/usr/bin/Xorg</code> &#8212; since <code>gdmflexiserver --xnest</code> is &#8220;not implemented&#8221;&#8230;</p>

<p>The wrapper script or <code>Xorg</code> replacement thus works like this:</p>

<p>First, we define the devices which we want to give the Xephyr use:</p>

<pre><code>#!/bin/zsh
mouse=Razer_Razer_1600dpi_3_button_optical_mouse
keybd=046a_0011</code></pre>

<p>These are examples from my box, the Razer is a mouse and the strange keyboard is a cheap Cherry one &#8212; who knows why they can&#8217;t afford to brand its <span class="caps">ID.</span> Look in <code>/dev/input/by-id</code> after connecting your devices to find out their IDs. This approach is more flexible than using the &#8220;event#&#8221; devices, whose numbering might change if connected differently.</p>

<p>Now construct the real paths and add some checks to see if the devices are connected:</p>

<pre><code>mouse=/dev/input/by-id/usb-${mouse}-event-mouse
keybd=/dev/input/by-id/usb-${keybd}-event-kbd
if [[ -h $keybd &amp;&amp; -h $mouse ]] {</code></pre>

<p><b>only in the Xorg case</b>, we now loop over all available displays and find the first one which has a empty xterm window created as outlined above, to plant the Xephyr into:</p>

<pre><code>	for ((disp=0;disp&lt;$((${DISPLAY#*:}+0));++disp)) {</code></pre>

<p><b>in the wrapper case</b>, we set the dummy disp variable instead</p>

<pre><code>	disp=$((${DISPLAY#*:}+0))</code></pre>

<p>finally, we locate the empty window using xwininfo and the <code>-title</code> as specified on top:</p>

<pre><code>	OIFS=$IFS; IFS=$'\n'
	winin=($(DISPLAY=:$disp xwininfo -name Xephyr -children)); IFS=$OIFS
	if [[ $winin[1]  'xwininfo: Window id: '*' "Xephyr"' && \
		$winin[4]  '     1 child:' &amp;&amp; \
		$winin[5]  *' (has no name): ()'* ]] {
		winid=($=winin[1])
		if [[ $winid[4]  0x* ]] {
			fontsdir=(/usr/share/fonts/*(/))</code></pre>

<p>Xephyr doesn&#8217;t seem to know about the default fonts, so we construct a fontsdir here, might need to adjust this to your local site font dirs. Now for the start command. <b>In case of the Xorg replacement for use with gdmflexiserver</b>, it is important to get rid of the <code>-verbose</code> flag which Xephyr does not understand. The <code>-parent</code> switch designs Xephyr to embed itself into another window:</p>

<pre><code>exec env DISPLAY=:$disp Xephyr -retro \
	-mouse evdev,,,device=$mouse \
	-keybd evdev,,device=$keybd,xkbmodel=evdev \
	-fp ${(j:,:)fontsdir} -parent $winid[4] \
	${@:#-verbose}</code></pre>

<p><b>for the wrapper script</b>, we use the <code>-query</code> parameter for xdmcp query:</p>

<pre><code>exec gnomesu -- Xephyr -retro \
	-mouse evdev,,,device=$mouse \
	-keybd evdev,,device=$keybd,xkbmodel=evdev \
	-fp ${(j:,:)fontsdir} -parent $winid[4] \
	-once -query $@</code></pre>

<p>just finish all the open blocks now&#8230;</p>

<pre><code>		}
	}
}</code></pre>

<p>however, in the <b>Xorg replacement script</b>, we will want to fall back to the <b>real</b> Xorg when we haven&#8217;t prepared any special window for Xephyr:</p>

<pre><code>}
exec Xorg.old $@</code></pre>

<p>As you can see, we moved <code>/usr/bin/Xorg</code> to <code>/usr/bin/Xorg.old</code> and put the replacement script up as <code>/usr/bin/Xorg</code> instead. That way, you can now prepare an xterm window as per above and execute <code>gdmflexiserver</code> without need for root.</p>

<p>With the wrapper script, just save it somewhere. You can then call it like this:</p>

<pre><code>./xephyr-xdmcp 127.0.0.1 :3</code></pre>

<p>Where 127.0.0.1 means your local host which you are going to query using xdmcp and :3 is a free display number for Xephyr to listen on.</p>

<p>An outstanding trouble I&#8217;m having in both cases is with the Gnome keyboard-properties tool which will set the keyboard layout upon login. Since it needs a different layout &#8212; evdev layout in the case of Xephyr, and local connected keyboard layout in the case of plain X, it will break the keyboard layout directly after login.</p>

<p>So far the only workaround is to rightclick on the desktop, &#8220;Open Terminal&#8221; and type in the command</p>

<pre><code>setxkbmap -model evdev</code></pre>

<p>before you can start working proper in the Xephyr instance. Maybe someone can come up with a better fix?</p>]]>
      
   </content>
</entry>
<entry>
   <title>int log2 in gcc / c++</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/06/int_log2_in_gcc_c/" />
   <id>tag:anti.teamidiot.de,2010://1.154</id>
   
   <published>2010-06-18T16:06:53Z</published>
   <updated>2010-06-18T16:11:46Z</updated>
   
   <summary>I wonder why this result isn&amp;#8217;t on google&amp;#8217;s #1 for int log2 gcc. To get the integer logarithm to the base of 2, try sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz( n ); sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Programmierung" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="296" label="c" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="297" label="c++" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="351" label="int" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="348" label="log" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="349" label="log2" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="350" label="logarithm" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>I wonder why this result isn&#8217;t on google&#8217;s #1 for int log2 gcc.</p>

<p>To get the integer logarithm to the base of 2, try</p>

<pre><code>      sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(   n );
     sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(  n );
sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll( n ); </code></pre>]]>
      
   </content>
</entry>
<entry>
   <title>SUN UNIX Keyboard &amp; Linux Gnome</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/06/sun_unix_keyboard_linux_gnome/" />
   <id>tag:anti.teamidiot.de,2010://1.153</id>
   
   <published>2010-06-02T20:30:59Z</published>
   <updated>2010-06-16T20:33:57Z</updated>
   
   <summary>I shot a UNIX keyboard on ebay. Of course, it &amp;#8220;just works&amp;#8221; when you plug it in. However, I want it to work properly, that is, the special keys on the left should show their labels when assigning them e.g....</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="347" label="alt" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="224" label="compose" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="36" label="gnome" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="2" label="keyboard" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="45" label="linux" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="346" label="meta" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="340" label="sun" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="341" label="tastatur" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="345" label="type 7" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="342" label="unix" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="343" label="xkb" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>I shot a <span class="caps">UNIX </span>keyboard on ebay.</p>

<p class="right" style="float:right;padding-left:1em"><a href="/u/nei/sun_unix_keyb.jpg"><img alt="sun_unix_keyb.jpg" src="/u/nei/sun_unix_keyb-thumb.jpg" width="306" height="230" /></a></p>

<p>Of course, it &#8220;just works&#8221; when you plug it in. However, I want it to work properly, that is, the special keys on the left should show their labels when assigning them e.g. in gnome-keybinding-properties. To do that, it is apparently necessary to edit the xkb rules &amp; xml files which are found in <code>/usr/share/X11/xkb/rules</code> on my distribution.</p>

<p>There is a &#8220;Sun Type 5/6&#8221; Layout available in gnome-keyboard-properties, but it mysteriously renders the BackSpace key unusuable &#8212; this might be a particular bug of my installation, any hints appreciated. (has apparently been fixed in <a href="http://cgit.freedesktop.org/xkeyboard-config/commit/?id=c954ef1dac2e1614572e3db02de07ebf0e974a95">this commit</a>, which probably means fixed in xkeyboard-config 1.8)</p>

<p><b>Update; the old solution provided problematic (it has been hidden below.)</b> Here is the new approach:</p>

<p>Fix the BackSpace key with this patch:</p>

<pre><code>--- a/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-16 20:39:59.937546375 +0200
+++ b/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-15 00:56:22.547604150 +0200
@@ -62,6 +62,8 @@ xkb_symbols &quot;sunbasic&quot; {
     include &quot;inet(evdev)&quot;
 
     include &quot;us(basic)&quot;
+    // these keys are common to all layouts
+    key &lt;BKSP&gt; {	[ BackSpace	]	};
     include &quot;pc(function)&quot;
     include &quot;pc(editing)&quot;
     include &quot;keypad(x11)&quot;</code></pre>

<p>Fix the &#8220;too old&#8221; AltGr mapping (XOrg changed it from Mode_switch to <span class="caps">ISO</span>_Level3_Shift, which is defined in the level3 symbols:)</p>

<pre><code>--- a/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-16 20:39:59.937546375 +0200
+++ b/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-15 00:56:22.547604150 +0200
@@ -74,7 +76,8 @@ xkb_symbols &quot;sunbasic&quot; {
     key &lt;LFSH&gt; { [ Shift_L		]			};
     key &lt;RTSH&gt; { [ Shift_R		]			};
     key &lt;LALT&gt; { [ Alt_L		]			};
-    key &lt;ALGR&gt; { [ Mode_switch		]			};
+//  key &lt;ALGR&gt; { [ Mode_switch		]			};
+    include &quot;level3(ralt_switch)&quot;
     key &lt;LMTA&gt; { [ Meta_L		]			};
     key &lt;RMTA&gt; { [ Meta_R		]			};
     key &lt;LCTL&gt; { [ Control_L		]			};</code></pre>

<p>Shuffle the modifier maps:</p>

<pre><code>--- a/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-16 20:39:59.937546375 +0200
+++ b/usr/share/X11/xkb/symbols/sun_vndr/us	2010-06-15 00:56:22.547604150 +0200
@@ -116,9 +119,9 @@ xkb_symbols &quot;sunbasic&quot; {
     modifier_map Control { Control_L, Control_R };
     modifier_map Shift   { Shift_R, Shift_L };
     modifier_map Mod1    { Meta_L, Meta_R };
-    modifier_map Mod2    { Mode_switch };
-    modifier_map Mod3    { Num_Lock };
-    modifier_map Mod4    { Alt_L };
+//  modifier_map Mod2    { Mode_switch };
+    modifier_map Mod2    { Num_Lock };
+    modifier_map Mod3    { Alt_L };
 };
 
 hidden</code></pre>

<p>Gnome wants its so-called &#8220;&lt;Alt&gt;&#8221;-binding on Mod1. I put the ♦Meta-keys there, because they&#8217;re in the right place. It further <strong>requires</strong> Mod2 to be Num_Lock, otherwise it is not happy and a lot of modifier keys stop working when Num_Lock is enabled. (Only the Mod2 is ignored when calculating the overlaps.) The former Mode_switch is mapped to Mod5 by the include above.</p>

<p>With this configuration, the following is now an useful addition to your <code>.Xresources</code>:</p>

<pre><code>xterm*metaSendsEscape: true
xterm*altIsNotMeta: true
xterm*altSendsEscape: false</code></pre>

<p>That way, Alt can be used to generate &#8220;Alternate keys&#8221; and ♦Meta works for key movement.</p>

<p>(X)Emacs on the other hand wants all kinds of &#8220;Meta&#8221; to be on one modifier, and (optionally) all kinds of &#8220;Alt&#8221; on the same, or another. My previous setup was causing <strong>one</strong> Meta key and the Alt key mapped to Mod1, and another one to Mod4. With the modifier mappings above, Meta correctly generates M- and Alt &#8212; generates A- (Super, aka Win-key, would get interpreted as S- in XEmacs.)</p>

<p>I suspect since I have not bound any &lt;Super&gt; keys, <strong>Gnome-Do</strong> is now confused and launches on a simple press of the Space-bar! Makes you unable to types spaces. I don&#8217;t know how to fix this. Trying to assign Alt+space as the Summon Key fails &#8212; it only displays &#8220;space&#8221;&#8230; since I don&#8217;t use Gnome-Do anyway, I removed it for now using <code>gnome-session-properties</code>.</p>

<p>I wanted to add the <span class="caps">UNIX </span>layout to the keyboard image display in the Gnome keyboard properties, so I made a new layout in the rules directory:</p>

<p>1. Added a new model to <code>base.xml</code>:</p>

<pre><code>    &lt;model&gt;
      &lt;configItem&gt;
        &lt;name&gt;sun_unix&lt;/name&gt;
        &lt;description&gt;Sun Type USB UNIX Layout&lt;/description&gt;
        &lt;vendor&gt;Sun Microsystems&lt;/vendor&gt;
      &lt;/configItem&gt;
    &lt;/model&gt;</code></pre>

<p>2. Do the same for <code>base.lst</code></p>

<pre><code>! model
  sun_unix        Sun Type USB UNIX Layout</code></pre>

<p>3. Add rules to <code>base</code> that set the desired options, on the way also fixing the missing geometry for the type6 and euro keyboard:</p>

<pre><code>! model		=	keycodes
  sun_unix 	=	sun(type6_usb)

! model		=	geometry
  sun6	 	=	sun(type6)
  sun_unix 	=	sun(type6unix)
  sun6euro 	=	sun(type6tuv)

! model		layout			=	symbols
  sun_unix	us			=	sun_vndr/us(type6)
  sun_unix	*			=	sun_vndr/us(type6)+%l%(v)</code></pre>

<p>Fix a bug in the <code>rules</code> that manifests when you use more than keyboard layout &#8212; because of the missing rules, the &#8220;pc&#8221; symbols are added, causing havok in the modifier mappings</p>

<pre><code>! model		layout[1]		=	symbols
  sun6		*			=	sun_vndr/us(type6)+%l[1]%(v[1])
  sun_unix	*			=	sun_vndr/us(type6)+%l[1]%(v[1])
  sun6euro	*			=	sun_vndr/us(type6)+%l[1]%(v[1])</code></pre>

<p>Modify the ctrl:nocaps rule to make CapsLock an additional right Control (the default key for example in VirtualBox) with this patch: (optional)</p>

<pre><code>--- a/usr/share/X11/xkb/symbols/ctrl	2010-06-16 20:39:59.922548680 +0200
+++ b/usr/share/X11/xkb/symbols/ctrl	2010-06-14 22:21:41.482666941 +0200
@@ -5,7 +5,8 @@
 // eliminate the caps lock key completely (replace with control)
 partial modifier_keys 
 xkb_symbols &quot;nocaps&quot; {
-    replace key &lt;CAPS&gt;	{  [ Control_L, Control_L ] };
+//  replace key &lt;CAPS&gt;	{  [ Control_L, Control_L ] };
+    replace key &lt;CAPS&gt;	{  [ Control_R ] };
     modifier_map  Control { &lt;CAPS&gt;, &lt;LCTL&gt; };
 };
 </code></pre>

<p>Fix the geometry (caps and control are swapped):</p>

<pre><code>--- a/usr/share/X11/xkb/geometry/sun	2010-06-16 20:39:59.910515296 +0200
+++ b/usr/share/X11/xkb/geometry/sun	2010-06-14 22:29:08.208691859 +0200
@@ -2885,7 +2885,7 @@ xkb_geometry &quot;t6unix&quot; {
 	};
 	row {
 	    top= 39;
-	    keys { &lt;FRNT&gt;, &lt;COPY&gt;, { &lt;CAPS&gt;, 9, shape=&quot;CAPS&quot; },
+	    keys { &lt;FRNT&gt;, &lt;COPY&gt;, { &lt;LCTL&gt;, 9, shape=&quot;LCTL&quot; },
 		   &lt;AC01&gt;, &lt;AC02&gt;, &lt;AC03&gt;, &lt;AC04&gt;, &lt;AC05&gt;, 
 		   &lt;AC06&gt;, &lt;AC07&gt;, &lt;AC08&gt;, &lt;AC09&gt;, &lt;AC10&gt;, 
 		   &lt;AC11&gt;,
@@ -2902,7 +2902,7 @@ xkb_geometry &quot;t6unix&quot; {
 	};
 	row {
 	    top= 77;
-	    keys { &lt;FIND&gt;, &lt;CUT&gt;, { &lt;LCTL&gt;, 9, shape=&quot;LCTL&quot; },
+	    keys { &lt;FIND&gt;, &lt;CUT&gt;, { &lt;CAPS&gt;, 9, shape=&quot;CAPS&quot; },
 		   &lt;LALT&gt;, {&lt;LMTA&gt;, &quot;LMTA&quot;},
 		 { &lt;SPCE&gt;, &quot;SPCE&quot; },
 		   {&lt;RMTA&gt;, &quot;RMTA&quot;}, &lt;COMP&gt;, &lt;ALGR&gt;</code></pre>

<p><em>Other problems</em></p>

<p>Unfortunately, I cannot get the Compose <span class="caps">LED </span>to light up.</p>

<p><b>Gnome doesn&#8217;t accept the SunFront keybinding to bring windows to the front &#8212; what&#8217;s up with that?? It works when I just assign it, but stops working on next login.</b> As a workaround, I could get it to work by setting <code>/apps/metacity/window_keybindings/raise_or_lower</code> to the magical value <code>0x8c</code> in <code>gconf-editor</code></p>

<p>It is not neccessary to choose any options in the gnome-keyboard-properties.</p>]]>
      <![CDATA[<p><hr/></p>

Following was my first attempt, it has the problem that it confuses Emacs about which modifier bits are Alt, and which are Meta. <blockquote>1. Added a new model to <code>base.xml</code>:

<pre><code>    &lt;model&gt;
      &lt;configItem&gt;
        &lt;name&gt;sun_pcusb_unix&lt;/name&gt;
        &lt;description&gt;Sun Type USB PC Symbols UNIX Layout&lt;/description&gt;
        &lt;vendor&gt;Sun Microsystems&lt;/vendor&gt;
      &lt;/configItem&gt;
    &lt;/model&gt;</code></pre>

<p>2. Do the same for <code>base.lst</code></p>

<pre><code>! model
  sun_pcusb_unix  Sun Type USB PC Symbols UNIX Layout</code></pre>

<p>3. Add rules to <code>base</code> that set the desired options:</p>

<pre><code>! model		 =	keycodes
  sun_pcusb_unix =	sun(type6_usb)

! model		 =	geometry
  sun_pcusb_unix =	sun(type6unix)

! model		 =	symbols
  sun_pcusb_unix =      +sun_vndr/usb(sun_usb)+sun_vndr/solaris(xf86keynames)</code></pre>

<p>I chose to add the section xf86keynames there, as this renames some Sun-Keys to <span class="caps">XF86</span>-Keys, like SunCopy &#8212;&gt; <span class="caps">XF86C</span>opy (don&#8217;t know if this of any use) and SunAudioLowerVolume &#8212;&gt; <span class="caps">XF86A</span>udioLowerVolume (which happens to match a Gnome default keybinding)</p>

<p>I should add that these keys worked before (plug&amp;play, with the generic &#8220;pc105&#8221; keycodes) but stop doing so if I load the sun(type6_usb) ones.</p>

<p>One outstanding issue is that the ♦ (Diamond-)keys generate Alt+Mod4+ in Gnome (or &lt;Alt&gt;&lt;Super&gt;), and M-S- in Emacs. I suspect it&#8217;s the lines</p>

<pre><code>    key &lt;LMTA&gt; { [	Meta_L		]	};
    key &lt;RMTA&gt; { [	Meta_R		]	};</code></pre>

<p>in the sun_usb symbols definition that cause this.</p>

<p>Another one is, that I don&#8217;t know if/how the Cut/Copy/Paste can be made use of.</p>

<p>And finally, the original sun6 layout maps ♦ (Diamond-)keys to Meta, but Meta shows up as &#8220;Alt&#8221; in Gnome. So I wonder what to do with this binding. Traditionally, the bindings should be on the Meta ♦ keys, also because they are larger. But because Gnome now writes Alt everywhere, this is getting misleading (other persons using the computer &#8220;why is Alt written on this key when it does not <strong>do</strong> Alt?&#8221;)</p>

<p>Alt is, by the sun6 layout, mapped to &lt;Super&gt;, i.e. the Windows-Keys on Windows-keyboards.</p>

The final tweaks I chose directly from the gnome-keyboard-properties: &#8220;Adding €-sign to 4 key&#8221; (as printed on the keyboard) and &#8220;Key to choose 3rd level: Right Alt&#8221; &#8212; that makes AltGraph work as I think it should.</blockquote>]]>
   </content>
</entry>
<entry>
   <title>cpan for local user configuration</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/05/cpan_for_local_user_configurat/" />
   <id>tag:anti.teamidiot.de,2010://1.152</id>
   
   <published>2010-05-26T07:25:45Z</published>
   <updated>2010-05-26T08:37:13Z</updated>
   
   <summary><![CDATA[To install perl modules without root permission, this seems to work for me within cpan: o conf mbuildpl_arg &quot;\ --lib=~/myperl/lib \ --installman1dir=~/myperl/man/man1 \ --installman3dir=~/myperl/man/man3 \ --installscript=~/myperl/bin \ --installbin=~/myperl/bin \ --install_base=~/myperl&quot; o conf makepl_arg &quot;\ LIB=~/myperl/lib \ INSTALLMAN1DIR=~/myperl/man/man1 \ INSTALLMAN3DIR=~/myperl/man/man3 \...]]></summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Programmierung" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="339" label="cpan" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="186" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>To install perl modules without root permission, this seems to work for me within <code>cpan</code>:</p>

<pre><code>o conf mbuildpl_arg &quot;\
--lib=~/myperl/lib \
--installman1dir=~/myperl/man/man1 \
--installman3dir=~/myperl/man/man3 \
--installscript=~/myperl/bin \
--installbin=~/myperl/bin \
--install_base=~/myperl&quot;

o conf makepl_arg &quot;\
LIB=~/myperl/lib \
INSTALLMAN1DIR=~/myperl/man/man1 \
INSTALLMAN3DIR=~/myperl/man/man3 \
INSTALLSCRIPT=~/myperl/bin \
INSTALLBIN=~/myperl/bin \
INSTALL_BASE=~/myperl&quot;

o conf commit</code></pre>

<p>Then add something like</p>

<p><code>export PERL5LIB=~/myperl/lib:~/myperl/lib/perl5/site_perl/5.10.0${PERL5LIB:+:}$PERL5LIB</code></p>

<p>to your <code>.zshenv</code> or environment profile. I had to add the site_perl dir because Sub::Uplevel installed there, yes, I&#8217;m too lazy to investigate. So beware of strange makefiles.</p>

<p>Now you can restart cpan with the <span class="caps">PERL5LIB </span>environment set and should be able to install modules.</p>

<p>I had to switch <span class="caps">INSTALL</span>_BASE for <span class="caps">PREFIX </span>in the past, ymmv.</p>]]>
      
   </content>
</entry>
<entry>
   <title>rc.status on the left??</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/05/rcstatus_on_the_left/" />
   <id>tag:anti.teamidiot.de,2010://1.151</id>
   
   <published>2010-05-19T13:53:38Z</published>
   <updated>2010-06-02T21:39:29Z</updated>
   
   <summary><![CDATA[Result: Useful if you have a huge resolution and having trouble making out which line the &#8220;failed&#8221; belongs to :-) --- /etc/rc.status 2010-05-19 16:05:42.561038358 +0200 +++ /etc/rc.status 2010-05-19 10:09:18.287053928 +0200 @@ -70,14 +70,15 @@ attn=&quot;${esc}[1;33m&quot; norm=`echo -en &quot;${esc}[m\017&quot;` stat=`echo -en...]]></summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="338" label="left" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="218" label="opensuse" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="337" label="rc.status" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>Result:<br />
<a href="/u/nei/status_left.html" onclick="window.open('/u/nei/status_left.html','popup','width=700,height=440,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="/u/nei/status_left-thumb.png" width="300" height="188" alt="" /></a></p>

<p>Useful if you have a huge resolution and having trouble making out which line the &#8220;failed&#8221; belongs to :-)</p>

<pre><code>--- /etc/rc.status      2010-05-19 16:05:42.561038358 +0200
+++ /etc/rc.status      2010-05-19 10:09:18.287053928 +0200
@@ -70,14 +70,15 @@
         attn=&quot;${esc}[1;33m&quot;
         norm=`echo -en &quot;${esc}[m\017&quot;`
         stat=`echo -en &quot;\015${esc}[${COLUMNS}C${esc}[10D&quot;`
+        stat=`echo -en &quot;\015${esc}[G${esc}[14@${esc}[10C...${esc}[11D&quot;`
 
-     rc_done=&quot;${stat}${done}done${norm}&quot;
+     rc_done=&quot;${stat}   ${done}done${norm}&quot;
   rc_running=&quot;${stat}${done}running${norm}&quot;
-   rc_failed=&quot;${stat}${warn}failed${norm}&quot;
+   rc_failed=&quot;${stat} ${warn}failed${norm}&quot;
    rc_missed=&quot;${stat}${warn}missing${norm}&quot;
   rc_skipped=&quot;${stat}${attn}skipped${norm}&quot;
-     rc_dead=&quot;${stat}${warn}dead${norm}&quot;
-   rc_unused=&quot;${stat}${extd}unused${norm}&quot;
+     rc_dead=&quot;${stat}   ${warn}dead${norm}&quot;
+   rc_unused=&quot;${stat} ${extd}unused${norm}&quot;
   rc_unknown=&quot;${stat}${attn}unknown${norm}&quot;
   rc_done_up=&quot;${esc}[1A${rc_done}&quot;
 rc_failed_up=&quot;${esc}[1A${rc_failed}&quot;</code></pre>

<p>More refinement with <code>xtty=$(stty -g); stty -echo; echo -en &quot;\033[6n&quot;; read -d R curpos; stty $xtty</code>, then see if cursor is at beginning of line and go up one line.</p>]]>
      
   </content>
</entry>
<entry>
   <title>ASRock X58 Extreme3</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/05/asrock_x58_extreme3_1/" />
   <id>tag:anti.teamidiot.de,2010://1.150</id>
   
   <published>2010-05-17T12:17:35Z</published>
   <updated>2010-06-02T21:38:35Z</updated>
   
   <summary>Installed an ASRock X58 Extreme3 motherboard, so far the following results: Linux Kernel 2.6.34 basic function works out of the box (as expected!) hibernate (suspend to disk) breaks should work if you unload xhci_hcd (USB3) suspend to ram (mem) suspends,...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="325" label="asrock" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="331" label="clock skew" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="327" label="extreme3" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="335" label="fan" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="45" label="linux" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="329" label="mainboard" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="328" label="motherboard" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="332" label="resume" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="334" label="sensors" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="82" label="suspend" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="333" label="usb3" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="326" label="x58" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>Installed an <span class="caps">ASR</span>ock <span class="caps">X58</span> Extreme3 motherboard, so far the following results:</p>

<p class="right" style="float:right;padding-left:1em"><a href="/u/nei/x58_extreme3.jpg"><img src="/u/nei/x58_extreme3-thumb.jpg" width="306" height="230" alt="" /></a></p>

<p>Linux Kernel 2.6.34</p>


<ul>
<li>basic function works out of the box (as expected!)</li>
<li>hibernate (suspend to disk) breaks
<ul>
<li>should work if you unload xhci_hcd (USB3)</li>
</ul>
</li>
<li>suspend to ram (mem) suspends, but does not resume
<ul>
<li>caps lock &amp; scroll lock <span class="caps">LED</span>s flash on resume</li>
<li>diagnostic <span class="caps">LED </span>shows 24</li>
<li>pm_tests pass</li>
<li>pm_trace hash matches drivers/base/power/main.c:564</li>
</ul>
</li>
<li><code>sensors</code> shows some coretemp temperatures
<ul>
<li><span class="caps">W83677HG</span>-I has no driver (would be needed to read fan speed, vcore, etc.)</li>
</ul>
</li>
<li>couldn&#8217;t find <strong>any</strong> controllable fan (BIOS can control 2 pwm fans and 2 voltage fans, but only manually except <span class="caps">CPU </span>fan)</li>
<li>system <strong>clock</strong> is way too slow! It lags 10 minutes just after 2 hours of operating. hardware clock seems to be fine though(?)</li>
</ul>



<p>maybe not related to the board</p>


<ul>
<li>Sony photo camera is not recognized as mass storage unless <code>rmmod -f usb_storage &amp;&amp; modprobe usb-storage</code> <strong>after</strong> connecting; somewhat annoying.</li>
</ul>



<p>not used yet:</p>


<ul>
<li><span class="caps">USB3</span></li>
<li><span class="caps">SATA3 </span>(6Gb/s)</li>
</ul>



<p>overclocking experiments</p>


<ul>
<li>can easily adjust <span class="caps">QPI </span>/ core speed in <span class="caps">BIOS. </span></li>
</ul>



<p>random thoughts</p>


<ul>
<li>I feared most the northbridge cooler fan; but it is perfectly silent (to my ears).</li>
<li><span class="caps">ECC </span>ram works as advertised</li>
<li>remember to turn on virtualization features and turbo boost stuff in <span class="caps">BIOS </span>(everyone would check that, I guess)</li>
<li>direct <span class="caps">BIOS </span>flash from <span class="caps">USB </span>is very convenient</li>
<li>use amidmi or amidedos to edit dmi data</li>
</ul>

]]>
      
   </content>
</entry>
<entry>
   <title>xmessage utf-8</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/02/xmessage_utf8/" />
   <id>tag:anti.teamidiot.de,2010://1.149</id>
   
   <published>2010-02-24T11:22:11Z</published>
   <updated>2010-02-24T11:33:27Z</updated>
   
   <summary>People are claiming that xmessage does not support unicode utf-8, or that you should switch to some gnome crap instead. Try specifying the resource *international: true and it will work as advertised. (You might still have to set up your...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="113" label="utf-8" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="324" label="xmessage" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>People are <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=505893">claiming</a> that <code>xmessage</code> does not support unicode utf-8, or that you should switch to some <a href="https://bugzilla.redhat.com/show_bug.cgi?id=496701">gnome</a> <a href="http://murga-linux.com/puppy/viewtopic.php?t=25319">crap</a> instead. Try specifying the resource <code>*international: true</code> and it will work as advertised. (You might still have to set up your fonts properly.)</p>

<p>By the way, a proper Gnome-alternative is <a href="http://live.gnome.org/Zenity">Zenity</a>.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Get back the Gnome logout keybinding </title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2010/02/get_back_the_gnome_logout_keyb/" />
   <id>tag:anti.teamidiot.de,2010://1.148</id>
   
   <published>2010-02-10T12:54:21Z</published>
   <updated>2010-02-10T13:06:54Z</updated>
   
   <summary><![CDATA[Since I upgraded Gnome from 2.24 to something more recent, what was then Ctrl+Alt+Del (or &lt;Control&gt;&lt;Alt&gt;Delete speaking of gconf settings) didn&#8217;t show the logout dialog anymore, but rather the shutdown/reboot one! I like to be able to log out or...]]></summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>Since I upgraded Gnome from 2.24 to something more recent, what was then Ctrl+Alt+Del (or <code>&lt;Control&gt;&lt;Alt&gt;Delete</code> speaking of gconf settings) didn&#8217;t show the logout dialog anymore, but rather the shutdown/reboot one! I like to be able to log out or switch user with a keyboard shortcut, however, there is no predefined action which would lead to that dialog anymore.</p>

<p>As a workaround, create the following entries in the gnome registry, for example using <code>gconf-editor</code>:<br />
in <code>/apps/metacity/global_keybindings/run_command_10</code>, enter the keybinding (e.g. <code>&lt;Control&gt;&lt;Alt&gt;Delete</code>)<br />
in <code>/apps/metacity/keybinding_commands/command_10</code>, use the command <code>gnome-session-save --logout-dialog --gui</code> &#8212; this will do the magic trick of opening the log out dialog.</p>

<p>Disable the old binding to shutdown using <code>gnome-keybinding-properties</code> by clicking on the entry and hitting backspace, if desired.</p>]]>
      
   </content>
</entry>
<entry>
   <title>ZTE K3565-Z Vodafone Websessions (on OS X)</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nusse/2010/01/zte_k3565z_vodafone_websession/" />
   <id>tag:anti.teamidiot.de,2010://1.147</id>
   
   <published>2010-01-30T19:27:10Z</published>
   <updated>2010-01-30T19:46:59Z</updated>
   
   <summary>The K3565-Z is sold with Vodafone Websessions currently for 30 EUR (in Germany). There is no hardware-based Simlock, only the connector-software by Vodafone won&apos;t work with other networks, but this software sucks anyway. The problem seems to be to find...</summary>
   <author>
      <name>nusse</name>
      <uri>http://www.teamidiot.de/</uri>
   </author>
   
   <category term="319" label="K3565" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="206" label="osx" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="322" label="simlock" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="308" label="umts" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="320" label="vodafone" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="321" label="websessions" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="323" label="zerocd" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="317" label="zte" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>The K3565-Z is sold with Vodafone Websessions currently for 30 EUR (in Germany). There is no hardware-based Simlock, only the connector-software by Vodafone won't work with other networks, but this software sucks anyway. The problem seems to be to find the drivers.</p>

<p>Following is tested on OS X 10.6.2.</p>

<ul>
<li>Download the <a href="http://www.zte.com.au/downloads/software/MF626_MAC_UI_M02.zip">connection manager</a> (from this <a href="http://www.zte.com.au/main/Product_Downloads/MF626_downloads.htm">website</a>). It is for some device called MF626, which seems to be the same.<br>
Do not install this package but instead only ./Contents/Packages/drv.pkg (can be reached by e.g. right-click - show package contents).
</li>
<li>
Now plug in the UMTS-stick and wait for the ZeroCD-crap to be mounted. Eject the device in the Finder. Ignore any "found new devices"-messages for now. 
</li>
<li>
Open Terminal.app and run <tt>sudo screen /dev/tty.ZTEUSBATPort</tt>.<br>
Type: <tt>at+zcdrun=8</tt>, press enter. You should receive "Close autorun state result(0:FAIL 1:SUCCESS):1". The annoying flash-drive is now disabled.
</li>
<li>
Now open System Preferences and choose "ZTEUSBModem". Go through Advanced - Modem and choose "Generic" as vendor and "GPRS (GSM/3G)" as device. Don't forget to enter the APN if your provider requires you to do so.
</li>
<li>
Use <tt>*99#</tt> as phone number.
</li>
</ul>

<p>Sources:<br />
<ul><br />
<li><a href="http://technomat-helga.blogspot.com/">http://technomat-helga.blogspot.com/</a></li><br />
<li><a href="http://www.zte.com.au/downloads/USB_Modem_Config_Procedure.pdf">http://www.zte.com.au/downloads/USB_Modem_Config_Procedure.pdf</a></li><br />
</ul></p>]]>
      
   </content>
</entry>
<entry>
   <title>wine PPTVIEW (PowerPoint Viewer)</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2009/12/wine_pptview_powerpoint_viewer/" />
   <id>tag:anti.teamidiot.de,2009://1.146</id>
   
   <published>2009-12-02T18:35:17Z</published>
   <updated>2009-12-02T18:47:37Z</updated>
   
   <summary>wine c:/Program\ Files/Microsoft\ Office/Office12/PPTVIEW.EXE fixme:heap:HeapSetInformation 0x110000 1 (nil) 0 I&amp;#8217;m not sure maybe it is something particular to my wine install, but the PowerPoint Viewer refuses to start. I finally found out that this is caused by the environment variable...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="316" label="powerpoint" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="315" label="pptview" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<pre><code>wine c:/Program\ Files/Microsoft\ Office/Office12/PPTVIEW.EXE
fixme:heap:HeapSetInformation 0x110000 1 (nil) 0</code></pre>

<p>I&#8217;m not sure maybe it is something particular to my wine install, but the PowerPoint Viewer refuses to start. I finally found out that this is caused by the environment variable <code>LANG</code> being set to something other than <code>en_US.UTF-8</code>, so the fix&#8230;</p>

<pre><code>LANG=en_US.UTF-8 wine c:/Program\ Files/Microsoft\ Office/Office12/PPTVIEW.EXE </code></pre>

<p>Unfortunately, even with the powerpoint viewer I haven&#8217;t been able to view this presentation, which made me try this approach at all. It crashes at roughly the same position that OpenOffice.org goes into 100% <span class="caps">CPU </span>during import, oh well&#8230;</p>]]>
      <![CDATA[<pre><code>fixme:dc:GdiIsMetaPrintDC 0x1964
wine: Unhandled page fault on read access to 0x00000048 at address 0x3bd2f07f (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0x00000048 in 32-bit code (0x3bd2f07f).
Register dump:
 CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
 EIP:3bd2f07f ESP:0033b160 EBP:0033b170 EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00110001 EBX:03596cc8 ECX:00000048 EDX:00000011
 ESI:035b7290 EDI:00000000</code></pre>]]>
   </content>
</entry>
<entry>
   <title>Linux中文手写输入法使用Chrasis的SCIM写字板和汉统／北京文通的辨识软件</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2009/10/linuxchrasisscim/" />
   <id>tag:anti.teamidiot.de,2009://1.143</id>
   
   <published>2009-10-30T17:29:40Z</published>
   <updated>2009-10-31T18:42:10Z</updated>
   
   <summary>Linux中文手写输入法使用Chrasis的SCIM写字板和汉统／北京文通的辨识软件。 Screenshot FLV...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="155" label="acpi" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="122" label="chinese" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="311" label="handwriting" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="121" label="input method" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="118" label="scim" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="313" label="unihan" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p><em>Linux中文手写输入法使用<a href="http://chrasis.blogspot.com/">Chrasis</a>的<a href="http://www.scim-im.org/"><span class="caps">SCIM</span></a>写字板和<a href="http://wiki.openrays.org/index.php?title=%E6%B1%89%E7%BB%9F%E4%B8%AD%E6%96%87%E8%BE%93%E5%85%A5%E5%B9%B3%E5%8F%B0">汉统</a>／北京文通的辨识软件。<br />
<embed 
  src="/static/player.swf" 
  width="500"
  height="300"
  allowscriptaccess="always"
  allowfullscreen="true"
  flashvars="file=/u/nei/hanzi.flv&amp;image=/u/nei/hanzi.png"
/></em><br />
<a href="/u/nei/hanzi.png">Screenshot</a> <a href="/u/nei/hanzi.flv"><span class="caps">FLV</span></a></p>]]>
      
   </content>
</entry>
<entry>
   <title>Unihan-Wtpen SCIM chinese character handwriting recognition under Linux</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2009/10/unihanwtpen_scim_chinese_chara_1/" />
   <id>tag:anti.teamidiot.de,2009://1.145</id>
   
   <published>2009-10-30T17:29:39Z</published>
   <updated>2009-11-09T15:27:31Z</updated>
   
   <summary>Chinese character handwriting recognition under Linux using the Chrasis Input Pad for SCIM and the Unihan-Wtpen recognition engine by Wintone (Beijing)....</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="122" label="chinese" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="311" label="handwriting" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="121" label="input method" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="118" label="scim" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="313" label="unihan" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="314" label="wtpen" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>Chinese character handwriting recognition under Linux using the <a href="http://chrasis.blogspot.com/">Chrasis</a> Input Pad for <a href="http://www.scim-im.org/"><span class="caps">SCIM</span></a> and the <a href="http://www.sw-linux.com/en/scripts/main/viewitem.php?itemid=2158511108981584&amp;showid=products&amp;catid=platforms">Unihan-Wtpen</a> recognition engine by Wintone (Beijing).</p>]]>
      <![CDATA[<p><embed 
  src="/static/flv.swf" 
  width="500"
  height="300"
  allowscriptaccess="always"
  allowfullscreen="true"
  flashvars="config={'playlist':['/u/nei/hanzi.png',{'url':'/u/nei/hanzi.flv','autoPlay':false}]}"
/><br />
<em><a href="/u/nei/hanzi.png">Screenshot</a> <a href="/u/nei/hanzi.flv"><span class="caps">FLV</span></a></em></p>]]>
   </content>
</entry>
<entry>
   <title>screencast with ffmpeg</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2009/10/screencast_with_ffmpeg/" />
   <id>tag:anti.teamidiot.de,2009://1.142</id>
   
   <published>2009-10-30T16:39:33Z</published>
   <updated>2009-10-30T16:44:19Z</updated>
   
   <summary>ffmpeg can record the X server screen for you and store it directly for example in Flash Screen Video format. This is much more favourable than some other solutions in my opinion :-) example: ffmpeg -f x11grab -s 1024x600 -r...</summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="309" label="ffmpeg" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="310" label="screencast" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p><a href="http://ffmpeg.org/">ffmpeg</a> can record the X server screen for you and store it directly for example in Flash Screen Video format. This is much more favourable than some other solutions in my opinion :-)</p>

<p>example: <code>ffmpeg -f x11grab -s 1024x600 -r 120 -i :0.0 -vcodec flashsv /tmp/out.flv</code></p>

<p><code>1024x600</code> is the screen size and <code>120</code> the rate. Important is the <code>.flv</code>-extension for the suitable container format.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Disable ZeroCD on Huawei UMTS USB-sticks</title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nusse/2009/10/disable_zerocd_on_huawei_umts/" />
   <id>tag:anti.teamidiot.de,2009://1.141</id>
   
   <published>2009-10-10T19:33:58Z</published>
   <updated>2009-10-11T14:47:11Z</updated>
   
   <summary>The Huawei E1552 (and other) UMTS USB-stick provides a ZeroCD called flashdrive, which provides drivers and utilities. To disable it (and prevent it to be mounted all the time), you can use the following AT-command: at^u2diag=0 (Source: Huawei forums)...</summary>
   <author>
      <name>nusse</name>
      <uri>http://www.teamidiot.de/</uri>
   </author>
         <category term="Linux" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="306" label="huawei" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="308" label="umts" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<p>The Huawei E1552 (and other) UMTS USB-stick provides a ZeroCD called flashdrive, which provides drivers and utilities. To disable it (and prevent it to be mounted all the time), you can use the following AT-command:</p>

<p><code><br />
at^u2diag=0<br />
</code><br />
(Source: <a href="http://forum.huawei.com/jive4/thread.jspa?threadID=324405&tstart=0&orderStr=8">Huawei forums</a>)</p>]]>
      
   </content>
</entry>
<entry>
   <title>calling C++ bind-bound functions with variable parameters </title>
   <link rel="alternate" type="text/html" href="http://anti.teamidiot.de/nei/2009/10/calling_c_bindbound_functions/" />
   <id>tag:anti.teamidiot.de,2009://1.140</id>
   
   <published>2009-10-04T20:51:13Z</published>
   <updated>2009-10-04T21:02:45Z</updated>
   
   <summary><![CDATA[/* Consider this following small example program. */ #include &lt;functional&gt; #include &lt;iostream&gt; using namespace std::placeholders; /* We write a subroutine that outputs the multiple of its arguments, a and b. */ void multiple(int a, int b, const std::string &amp; who)...]]></summary>
   <author>
      <name>Nei</name>
      <uri>http://anti.teamidiot.de/</uri>
   </author>
         <category term="Programmierung" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="298" label="bind" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="297" label="c++" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="305" label="functional" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="304" label="g++" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="301" label="placeholder" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="300" label="std::bind" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="302" label="tr1" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://anti.teamidiot.de/">
      <![CDATA[<pre><code>/*</code></pre>

<p>  Consider this following small example program. </p>

<pre><code>*/
#include &lt;functional&gt;
#include &lt;iostream&gt;

using namespace std::placeholders;

/*</code></pre>

<p> We write a subroutine that outputs the multiple of its arguments, a and b.</p>

<pre><code>*/
void multiple(int a, int b, const std::string &amp; who) {
  std::cout &lt;&lt; who &lt;&lt; &quot;:\t&quot; &lt;&lt; a &lt;&lt; &quot;×&quot; &lt;&lt; b &lt;&lt; &quot;=&quot; &lt;&lt; a*b &lt;&lt; std::endl;
}

int main() {
  /*</code></pre>

<p>	We then call it from main.</p>

<pre><code> */
  multiple(2,3,&quot;direct&quot;);

  /*</code></pre>

<p>	Next, we want to use bind to bind some arguments and call it. Unsurprisingly, the output is the same.</p>

<pre><code> */
  std::bind(multiple,2,3,&quot;bind&quot;)();

  /*</code></pre>

<p>	We can also store this bound function and call it:</p>

<pre><code> */
  auto bound(std::bind(multiple,2,3,&quot;bound&quot;));
  bound();

  /*</code></pre>

<p>	Things get wicked, when we want to predefine only one parameter, though :(</p>

<pre><code> */
  //std::bind(multiple,2,_1,&quot;bindp&quot;)(3); // you wish!</code></pre>]]>
      <![CDATA[<pre><code> /*</code></pre>

<p>	That&#8217;s what my distribution&#8217;s latest <span class="caps">GNU</span> C++ compiler thinks about our try&#8230;</p>

<pre><code>	% g++-4.5 -Wall -pedantic -ansi -std=c++0x bind.cpp</code></pre>

<pre><code>bind.cpp: In function ‘int main()’:
bind.cpp:39:37: error: no match for call to ‘(std::_Bind&lt;void (*(int, std::_Placeholder&lt;1&gt;, const char*))(int, int, const std::basic_string&lt;char&gt;&amp;)&gt;) (int)’
/usr/include/c++/4.5/tr1_impl/functional:1189:9: note: candidates are: typename std::result_of&lt;_Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) [with _Args = int, _Functor = void (*)(int, int, const std::basic_string&lt;char&gt;&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*, typename std::result_of&lt;_Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type = void]
/usr/include/c++/4.5/tr1_impl/functional:1200:9: note:                 typename std::result_of&lt;const _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) const [with _Args = int, _Functor = void (*)(int, int, const std::basic_string&lt;char&gt;&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*, typename std::result_of&lt;const _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type = void]
/usr/include/c++/4.5/tr1_impl/functional:1212:9: note:                 typename std::result_of&lt;volatile _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) volatile [with _Args = int, _Functor = void (*)(int, int, const std::basic_string&lt;char&gt;&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*, typename std::result_of&lt;volatile _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type = void]
/usr/include/c++/4.5/tr1_impl/functional:1225:9: note:                 typename std::result_of&lt;const volatile _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) const volatile [with _Args = int, _Functor = void (*)(int, int, const std::basic_string&lt;char&gt;&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*, typename std::result_of&lt;const volatile _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type = void]</code></pre>

<p>	much like the one before:</p>

<pre><code>	% g++-4.4 -Wall -pedantic -ansi -std=c++0x bind.cpp</code></pre>

<pre><code>bind.cpp: In function ‘int main()’:
bind.cpp:39: error: no match for call to ‘(std::_Bind&lt;void (*(int, std::_Placeholder&lt;1&gt;, const char*))(int, int, const std::string&amp;)&gt;) (int)’
/usr/include/c++/4.4/tr1_impl/functional:1189: note: candidates are: typename std::result_of&lt;_Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args, std::is_bind_expression::value, (std::is_placeholder::value &gt; 0)&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) [with _Args = int, _Functor = void (*)(int, int, const std::string&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*]
/usr/include/c++/4.4/tr1_impl/functional:1200: note:                 typename std::result_of&lt;const _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args, std::is_bind_expression::value, (std::is_placeholder::value &gt; 0)&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) const [with _Args = int, _Functor = void (*)(int, int, const std::string&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*]
/usr/include/c++/4.4/tr1_impl/functional:1212: note:                 typename std::result_of&lt;volatile _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args, std::is_bind_expression::value, (std::is_placeholder::value &gt; 0)&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) volatile [with _Args = int, _Functor = void (*)(int, int, const std::string&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*]
/usr/include/c++/4.4/tr1_impl/functional:1225: note:                 typename std::result_of&lt;const volatile _Functor(typename std::result_of&lt;std::_Mu&lt;_Bound_args, std::is_bind_expression::value, (std::is_placeholder::value &gt; 0)&gt;(_Bound_args, std::tuple&lt;_UElements ...&gt;)&gt;::type ...)&gt;::type std::_Bind&lt;_Functor(_Bound_args ...)&gt;::operator()(_Args&amp; ...) const volatile [with _Args = int, _Functor = void (*)(int, int, const std::string&amp;), _Bound_args = int, std::_Placeholder&lt;1&gt;, const char*]</code></pre>

<p>	Not quite sure whether this is the expected behaviour.</p>

<p>	Note that we can still store the result; doesn&#8217;t mean that we could call it though:</p>

<pre><code> */
  auto boundp(std::bind(multiple,2,_1,&quot;boundp&quot;));
  //boundp(3); // you wish!

  /*</code></pre>

<p>	Our best bet is to fix the bind-expression to a function-type:</p>

<pre><code> */
  static_cast&lt;std::function&lt;void(int)&gt;&gt;(std::bind(multiple,2,_1,&quot;funs&quot;))(3);

  /*</code></pre>

<p>	Or just store it away, works nicely as well.</p>

<pre><code> */
  std::function&lt;void(int)&gt; funv(std::bind(multiple,2,_1,&quot;funv&quot;));
  funv(3);

  /*</code></pre>

<p>	(This solution did not work here with <span class="caps">GNU</span> C++ 4.5.0 20090925 (experimental) [trunk revision 152168], which garbles up the string parameter.)</p>

<pre><code> */
  return 0;
}</code></pre>]]>
   </content>
</entry>

</feed>