<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>TwiceTwo.com</title>
    <description>This is my blog. As opposed to the rest of my stuff.
</description>
    <link>http://twicetwo.com/</link>
    <atom:link href="http://twicetwo.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 08 Sep 2017 10:46:05 -0700</pubDate>
    <lastBuildDate>Fri, 08 Sep 2017 10:46:05 -0700</lastBuildDate>
    <generator>Jekyll v3.2.1</generator>
    
      <item>
        <title>Universal environment variables with pam_env</title>
        <description>&lt;p&gt;One of the minor annoyances of working in Unix-land is the variety of ways to
set user environment variables: &lt;code&gt;.zshenv&lt;/code&gt;, &lt;code&gt;.bash_profile&lt;/code&gt;, &lt;code&gt;.profile&lt;/code&gt;, 
&lt;code&gt;.xinitrc&lt;/code&gt;, and 
so forth. Depending on where you set them, your variables may be visible
in interactive shells, login shells, X applications, or some strange mixture.
Even worse is that some, but not all, environment variables are set when
interpreting your &lt;code&gt;crontab&lt;/code&gt;, so that has yet another set of rules you have to
remember. &lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve been gradually working on setting up my home directory so that it 
contains &lt;em&gt;everything&lt;/em&gt; (barring system packages) that I need to work, so that
migrating to a new computer is just a matter of installing packages and then
copying my &lt;code&gt;$HOME&lt;/code&gt;. This only works if I have a consistent way to set
environment variables, so that they are visible to &lt;em&gt;every&lt;/em&gt; program that
runs under my account, regardless of how I logon. And I think I&amp;rsquo;ve finally
got it. &lt;/p&gt;

&lt;p&gt;This process requires changing a couple of system-wide settings, but only in
special circumstances:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you care about having environment variables enabled when you login via
 TTY or SSH, make the following change to &lt;code&gt;/etc/pam.d/login&lt;/code&gt;: find the line &lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt; session       required   pam_env.so readenv=1 envfile=/etc/default/locale
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and change it to read&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt; session       required   pam_env.so readenv=1 user_readenv=1 envfile=/etc/default/locale
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;(In the default config, &lt;code&gt;pam_env&lt;/code&gt; is loaded only when you login via your
 display manager: MDM on Mint, GDM on Gnome, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you want to set &lt;code&gt;LD_LIBRARY_PATH&lt;/code&gt; then you have to make a change to 
 the Xsession settings: add a file &lt;code&gt;90preserve_ld_library_path&lt;/code&gt; to 
 &lt;code&gt;/etc/X11/Xsession.d/&lt;/code&gt; containing&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt; STARTUP=&quot;/usr/bin/env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${STARTUP}&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is only necessary because X normally starts ssh-agent which clears
 `LD&lt;em&gt;LIBRARY&lt;/em&gt;PATH for security reasons. Another option is to disable loading
 of ssh-agent entirely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you want your environment variables to apply to your crontab (and you do),
 edit &lt;code&gt;/etc/pam.d/cron&lt;/code&gt; and find the line&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt; session       required   pam_env.so envfile=/etc/default/locale
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;with&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt; session       required   pam_env.so user_readenv=1 envfile=/etc/default/locale
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After making that change(s), create a file &lt;code&gt;~/.pam_environment&lt;/code&gt; and add your
variables to it like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;# HOME is not defined when this file is executed, and BOOST_ROOT needs 
# to be set somewhere, so...
HOME       DEFAULT=/home/@{PAM_USER}
BOOST_ROOT DEFAULT=${HOME}/bin/boost

# Setup path
PATH DEFAULT=${HOME}/bin:${HOME}/bin/bin:${PATH}
PATH DEFAULT=${HOME}/bin/rakudo:${PATH}
PATH DEFAULT=/opt/texlive/2016/bin/x86_64-linux:${PATH}
PATH DEFAULT=/opt/teyjus:${PATH}
PATH DEFAULT=/opt/bin:${PATH}
PATH DEFAULT=${HOME}/.cabal/bin:${PATH}
PATH DEFAULT=${HOME}/.local/bin:${PATH}
PATH DEFAULT=/opt/cabal/1.20/bin:/opt/ghc/7.8.4/bin:${PATH}
PATH DEFAULT=${HOME}/bin/tmsu-x86_64-0.6.1/bin:${PATH}
PATH DEFAULT=${HOME}/bin/boost:${PATH}

# Python paths
PYTHONPATH DEFAULT=${HOME}/.local/lib/python/site-packages:${PYTHONPATH}
PYTHONPATH DEFAULT=${HOME}/.local/lib/python2.7/site-packages:${PYTHONPATH}

# Manpaths
MANPATH DEFAULT=/opt/texlive/2014/texmf/doc/man:${MANPATH}
MANPATH DEFAULT=${HOME}/docs/man:${MANPATH}
MANPATH DEFAULT=${HOME}/bin/man:${MANPATH}

# Infopaths
INFOPATH DEFAULT=/opt/texlive/2016/texmf/doc/info:${INFOPATH}

# Library/link paths
LD_LIBRARY_PATH DEFAULT=/usr/local/lib:${BOOST_ROOT}/stage/lib:${HOME}/lib:${HOME}/lib/sfml:${LD_LIBRARY_PATH}
LIBRARY_PATH    DEFAULT=${HOME}/lib:${HOME}/lib/sfml:${BOOST_ROOT}/stage/lib:${LIBRARY_PATH}

# Include paths
CPLUS_INCLUDE_PATH DEFAULT=${HOME}/include:${BOOST_ROOT}:${CPLUS_INCLUDE_PATH}

# TeX paths
TEXINPUTS DEFAULT=.:${HOME}/.texmf/tex/:
BIBINPUTS DEFAULT=.:${HOME}/.texmf/tex/:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is my actual &lt;code&gt;.pam_environment&lt;/code&gt;. Setting environment variables that
refer to other, existing variables (e.g., extending &lt;code&gt;$PATH&lt;/code&gt;) uses a fancy
syntax:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;NAME DEFAULT=...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Within the value, you can use &lt;code&gt;${...}&lt;/code&gt; to expand environment variables, and use
&lt;code&gt;@{...}&lt;/code&gt; to expand &lt;code&gt;PAM_ITEM&lt;/code&gt;s (as I did to get the user&amp;rsquo;s login name, because
&lt;code&gt;$USER&lt;/code&gt; isn&amp;rsquo;t set yet). &lt;/p&gt;

&lt;p&gt;After that, it&amp;rsquo;s basically a matter of setting things the way you want. Note
that if you aren&amp;rsquo;t using any expansions, you can write just&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;NAME=value...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With this setup, &lt;em&gt;all&lt;/em&gt; of my environment variables are available to any process
that runs under my account, including cron jobs! No more fighting with my
editor to get it to use my &lt;code&gt;$PATH&lt;/code&gt; when it runs my build tools, and no more
hard-coded paths in crontab, etc. &lt;/p&gt;
</description>
        <pubDate>Fri, 31 Mar 2017 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/linux/environment/variables/2017/03/31/universal-environment-variables.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/linux/environment/variables/2017/03/31/universal-environment-variables.html</guid>
        
        
        <category>linux</category>
        
        <category>environment</category>
        
        <category>variables</category>
        
      </item>
    
      <item>
        <title>Backpacking the Kaiser Loop trail, postmortem</title>
        <description>&lt;p&gt;My girlfriend and I backpacked almost the entire Kaiser Loop trail over 
three days, June 15-17 (we took the shortcut through Mary&amp;rsquo;s Meadow, shaves 2.1 mi. off the
entire loop). We traveled the loop &lt;a href=&quot;http://caltopo.com/m/62D0&quot;&gt;clockwise&lt;/a&gt;, 
which allowed us to split the elevation gain (nearly 3000 ft.) over two days. We
camped at Nellie lake the first night (8900 ft) and at Line Creek lake (9800 ft)
the second, climbing to the summit of Kaiser Peak on our third day before
heading down the mountain. Since I&amp;rsquo;ve already covered a bunch of backpacking
stuff in other posts, I&amp;rsquo;ll just briefly describe some things that I learned. &lt;/p&gt;

&lt;h2&gt;Map and Route&lt;/h2&gt;

&lt;iframe width=&quot;100%&quot; height=&quot;500px&quot; src=&quot;http://caltopo.com/m/62D0&quot;&gt;&lt;/iframe&gt;

&lt;h2&gt;Hiking with a partner&lt;/h2&gt;

&lt;p&gt;Hiking with a partner is a fantastic way to stave off insanity, provided, of
course, that they are willing and generally enthusiastic about it. I 
mentioned how, when I backpacked alone, my mind went to some strange places. 
This time I had no &amp;ldquo;mental moments&amp;rdquo;; the closest was a few dreams about losing
the trail (see below for the impetus for this). &lt;/p&gt;

&lt;h2&gt;Gear&lt;/h2&gt;

&lt;p&gt;I switched up a number of my gear choices this year, hoping to save weight.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I used a Gossamer Gear Mariposa backpack instead of my Deuter. The Mariposa
 has a smaller internal storage, which is only top-loading (no sleeping
 bag section with its own bottom zipper) which does require some discipline
 in packing. From bottom to top, I generally packed cookset, sleeping pad,
 sleeping bag (just stuffed into the pack), bear canister. The beauty of the
 Mariposa is the almost 20L of external storage it offers: I was able to pack
 my tent, water, water filtration, toilet kit, day clothes, and other items
 all into the external pockets for easy access and unpacking. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I switched my camera from an Olympus E420 to a Panasonic DMC-TS6R. This 
 is an &amp;ldquo;outdoor&amp;rdquo; camera: waterproof, shockproof, with GPS, altimeter, and
 compass so that your photos are (sometimes) geotagged with their location.
 It always weighs 8 oz to the Olympus&amp;rsquo;s 20 oz.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I switched my shoes from New Balance Minimus Zero, to the Montrail
 Massochist III. I actually tried three different pairs of shoes before the
 trip: the La Sportiva Ultra Raptors were unwearably painful. Even going up a size
 (as is recommended) they were so tight as to make my feet numb after less
 than an hour of normal walking, and they had weird plastic protrusions on
 the inside that dug into my skin. The other shoes I tried were Skarpa Spark
 trail runners; they were fine, just not as comfortable as the Montrails.&lt;/p&gt;

&lt;p&gt;The Montrail Masochist was great! It has a mesh upper so it (and my socks
 inside) dried quickly after getting wet. The tread is good and grippy, and
 performed well on wet rocks and snow. They do weigh more than the New 
 Balances, but no where near as much as a full boot; the weight is about 
 the same as the dress shoes I wear to work, so I didn&amp;rsquo;t really notice 
 them. They did feel a bit tight around the heel/Achiles tendon (as 
 people in Amazon reviews have complained about) but this was temporary;
 an hour of walking broke them in and flexed up that part of the shoe so
 that I had no discomfort at all. (I ended the trip with &lt;em&gt;zero&lt;/em&gt; blisters or
 hot spots on my feet.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I was forced to switch my water filtration from the Sawyer Squeeze to
 Aqua Mira, after my Squeeze decided to not work at all the first time I 
 tried to use it (note to self: always test water filter before leaving!).
 Aqua Mira takes longer than the Squeeze (5 mins for the chemicals to 
 &amp;ldquo;activate&amp;rdquo; and then 30 mins for it to purify) and thus requires some 
 scheduling and coordination. Generally I had two water bottles: one was
 in the process of being purified, while the other was drinkable. When
 necessary, I&amp;rsquo;d fill my girlfriend&amp;rsquo;s water bottle/pouch from my drinkable
 bottle. Whenever we hit a stream, we&amp;rsquo;d redistribute drinkable water and
 then refill any empty bottles with water to be purified as we walked. This
 worked well, and I&amp;rsquo;m glad I had the Aqua Mira as a backup. &lt;/p&gt;

&lt;p&gt;Note that 
 although the instructions don&amp;rsquo;t say so, you can in fact use 7-8 drops
 of &amp;ldquo;A&amp;rdquo; and &amp;ldquo;B&amp;rdquo; &lt;em&gt;for each liter&lt;/em&gt; to filter more than 1 liter at a time. 
 They also don&amp;rsquo;t mention that you should try to keep the time the mixture
 spends activating as close to 5 mins as possible; less or more means that
 the active ingredient will not be as concentrated and as a result,
 purification may take longer/not be as effective.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Snow&lt;/h2&gt;

&lt;p&gt;The middle of June is still &amp;ldquo;early&amp;rdquo; in the summer hiking season, at least for
the higher elevations. Above 9000 ft we had some areas with substantial snow
to deal with. Most of our problems came when the trail was covered for more
than a few yards; there were several places where we had no idea where the
trail was going and had to just forge ahead, hoping to find it once we got past
the snow. &lt;/p&gt;

&lt;p&gt;The most difficult section was just before and after the 
unnamed lake that lies at the foot of the switchbacks leading up to the ridge.
Below the lake, the trail follows the northern slopes (something that was not
shown on my map) which was more snow-covered, shaded, and steeper, than the
crest. At one point the trail was covered by a patch of snow that would have
been dangerous to cross; a slip would have sent us sliding down the side of
the mountain. We went off-trail and tracked around it until we picked up the
trail the rest of the way to the lake.&lt;/p&gt;

&lt;p&gt;Beyond the lake, the trail switchbacks up to the ridge; about halfway up the
trail was entirely covered in snow. We essentially just headed straight up,
climbing over rocks when possible but often crossing the snow, until we reached
the top and picked up the trail again. &lt;/p&gt;

&lt;p&gt;There were a few patches of snow on the way down, but these were smaller and
well-traveled, so that there was no doubt as to where the trail went.&lt;/p&gt;

&lt;h2&gt;Food&lt;/h2&gt;

&lt;p&gt;We did great for food! Our dinners were supplied by Packit Gourmet (gumbo and
chili). Their meals ostensibly &amp;ldquo;serve one&amp;rdquo; but are big enough that a single
meal can be extended to serve two without much trouble. E.g., to pad out the
gumbo we just added half a cup of instant rice and some summer sausage. I carried
a BearVault 500, but during the day my girlfriend kept a separate &amp;ldquo;snack bag&amp;rdquo;
in the top of her backpack for easy access. (At night we&amp;rsquo;d pack the whole
snack bag into the bear canister, obviously.) Each morning we&amp;rsquo;d put whatever we
intended to have for lunch into the snack bag before loading up. &lt;/p&gt;

&lt;p&gt;Our breakfast consisted of precooked bacon (reheated), coffee, and oatmeal with
freeze-dried fruit. (Note that freeze-dried strawberries rehydrate &lt;em&gt;much&lt;/em&gt; faster
than either blueberries or raspberries.)&lt;/p&gt;

&lt;p&gt;Lunch was sandwhiches from Subway (day 1), dehydrated pasta salad with salmon
(day 2), and cheese and crackers with summer sausage (day 3). Note that many 
people will advise you to wrap your cheese in wax paper so it can &amp;ldquo;breathe&amp;rdquo;,
suggesting that it will develop a dry skin. They&amp;rsquo;re right, but why not let it
develop that skin before you leave? Wrap it in wax paper and put it in the fridge
a couple days before you leave.&lt;/p&gt;

&lt;p&gt;Dinner was gumbo with extra rice and sausage (day 1) and chili with cracker
bread and bacon (day 2). Speaking of which, Armenian cracker bread is a fun
alternative to tortillas. Despite the name, it&amp;rsquo;s not crispy but is actually
quite flexible. You can use it as a kind of edible towel to clean out your pot
after a meal.&lt;/p&gt;
</description>
        <pubDate>Mon, 20 Jun 2016 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/backpacking/postmortem/kaiser/wilderness/2016/06/20/backpacking-kaiser-loop-trail.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/backpacking/postmortem/kaiser/wilderness/2016/06/20/backpacking-kaiser-loop-trail.html</guid>
        
        
        <category>backpacking</category>
        
        <category>postmortem</category>
        
        <category>kaiser</category>
        
        <category>wilderness</category>
        
      </item>
    
      <item>
        <title>Windows Protocol Handlers for Sysadmins</title>
        <description>&lt;p&gt;On Windows, it&amp;rsquo;s possible to create new &amp;ldquo;protocol handlers&amp;rdquo; so that URLs like
&lt;code&gt;ssh://hostname&lt;/code&gt;, &lt;code&gt;telnet://hostname&lt;/code&gt;, etc. are recognized and launch some
application (e.g., PuTTY). The only trickery is that Windows will pass the
&lt;em&gt;entire&lt;/em&gt; protocol string to the application (e.g., PuTTY will be launched with
the command line &lt;code&gt;putty telnet://hostname&lt;/code&gt;). For applications that understand
the protocol prefix this is fine, but otherwise we have to employ a bit of 
scripting trickery to strip it off. Following &lt;a href=&quot;http://stackoverflow.com/a/23339563&quot;&gt;this SO answer&lt;/a&gt;
led to the possibility of using protocol handlers for
all kinds of sysadmin things (the advantage being that protocol links can be
embedded in wikis, Visio diagrams, hotsheets, inventory systems, etc.). As creating the required
registry keys is a bit of a pain, I wrote &lt;a href=&quot;/downloads/regproto.js&quot;&gt;&lt;code&gt;regproto.js&lt;/code&gt;&lt;/a&gt;, 
a script for registering new protocol handlers.&lt;/p&gt;

&lt;p&gt;Some examples should make its usage clear (run these from a command prompt, in
the folder where you saved &lt;code&gt;regproto.js&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;regproto.js ping     &quot;ping -t %%HOST%%&quot;
regproto.js telnet   &quot;putty -telnet %%HOST%%&quot;
regproto.js ssh      &quot;putty -ssh %%HOST%%&quot; 
regproto.js cmd      &quot;psexec \\%%HOST%% cmd.exe&quot;
regproto.js shutdown &quot;shutdown /s /m \\%%HOST%%&quot;
regproto.js restart  &quot;shutdown /r /m \\%%HOST%%&quot;
regproto.js manage   &quot;mmc compmgmt.msc /computer=\\%%HOST%%&quot;
regproto.js ps       &quot;powershell -NoExit -Command Enter-PSSession -ComputerName %%HOST%%&quot;
regproto.js rdp      &quot;mstsc /v:%%HOST%%&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above will register &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;ping://&lt;/code&gt; handler which will open a console window with &lt;code&gt;ping -t&lt;/code&gt; running
 on the host.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The usual &lt;code&gt;ssh://&lt;/code&gt; and &lt;code&gt;telnet://&lt;/code&gt; handlers, linked to PuTTY (assuming it&amp;rsquo;s
 in your &lt;code&gt;%PATH%&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;cmd://&lt;/code&gt; handler that will use &lt;code&gt;psexec&lt;/code&gt; to launch a command interpreter
 on the remote machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;shutdown://&lt;/code&gt; handler that will shutdown the remote machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;restart://&lt;/code&gt; handler that will restart the remote machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;manage://&lt;/code&gt; handler that will launch the Computer Management snapin 
 connected to the remote machine. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;ps://&lt;/code&gt; handler that will run Powershell on the remote machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;rdp://&lt;/code&gt; handler that will launch a remote desktop connection to the 
 target machine.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The only required arguments are the protocol name, and the command string to 
launch. The command string can refer to &lt;code&gt;%%HOST%%&lt;/code&gt;, the &amp;ldquo;hostname&amp;rdquo; (or whatever)
given in the &lt;code&gt;protocol://hostname&lt;/code&gt;. Note that this could include a username and
password, if your application understands those (PuTTY does, so you can do
&lt;code&gt;telnet://username@hostname&lt;/code&gt; and it will work). &lt;/p&gt;

&lt;p&gt;The full documentation for &lt;code&gt;regproto&lt;/code&gt; is in a big comment at the top of the 
file (pay special attention to the note at the bottom about custom protocols
in Firefox and Chrome). &lt;/p&gt;

&lt;p&gt;&lt;code&gt;regproto&lt;/code&gt; will create a script &lt;code&gt;urllaunch.js&lt;/code&gt; in &lt;code&gt;%SystemRoot%\System32&lt;/code&gt;. This
script is used to launch applications with the URL given, but with the protocol
stripped off. It&amp;rsquo;s possible that (e.g.) antivirus might block the creation of
this script, in which case you won&amp;rsquo;t be able to register any protocols.&lt;/p&gt;

&lt;hr&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href=&quot;/downloads/regproto.js&quot;&gt;Download &lt;code&gt;regproto.js&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 08 Jun 2016 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/windows/sysadmin/protocol/handler/ping/ssh/2016/06/08/windows-protocol-handlers-sysadmins.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/windows/sysadmin/protocol/handler/ping/ssh/2016/06/08/windows-protocol-handlers-sysadmins.html</guid>
        
        
        <category>windows</category>
        
        <category>sysadmin</category>
        
        <category>protocol</category>
        
        <category>handler</category>
        
        <category>ping</category>
        
        <category>ssh</category>
        
      </item>
    
      <item>
        <title>Backpacking: Shoes</title>
        <description>&lt;p&gt;(Updated June 8, 2016)&lt;/p&gt;

&lt;p&gt;Except for the off-trail mountaineers among us, the old 10 lb. hiking boots have
fallen out of favor. With research&lt;sup id=&quot;fnref1&quot;&gt;&lt;a href=&quot;#fn1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; finding that weight&lt;sup id=&quot;fnref2&quot;&gt;&lt;a href=&quot;#fn2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; on your feet requires 
approx 5x the energy&lt;sup id=&quot;fnref3&quot;&gt;&lt;a href=&quot;#fn3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; to move as weight carried elsewhere, there&amp;rsquo;s good reason
to lighten our foot load.&lt;/p&gt;

&lt;p&gt;My &amp;ldquo;go to&amp;rdquo; hiking shoes, when it&amp;rsquo;s not cold or wet, have been New Balance 
Minimus trail running shoes. A pair weighs less than 6 oz, and with all the mesh they
breathe incredible well. I actually own two pair: one in garishly neon blue, and
another in glow-in-the-dark white (&lt;em&gt;style&lt;/em&gt; is the last refuge of the incompetent). &lt;/p&gt;

&lt;p&gt;Although I normally wear a size 11.5, and that works fine for day hiking with a
lighter pack, I think it&amp;rsquo;s too small for backpacking. Being on your feet all day,
and carrying more weight, makes your feet both swell and &amp;ldquo;pancake&amp;rdquo; (flatten
out). My right big toe was numb for weeks afterwards, from being pressed inside
my shoe. Although most people recommend you get a &amp;ldquo;good&amp;rdquo; fitting shoe (because
having your feet slide around in your shoes is a good way to get blisters) I 
think I&amp;rsquo;ll risk a 12, 12.5 or 12W next time. &lt;/p&gt;

&lt;p&gt;I had no problems with stability, &amp;ldquo;rolling&amp;rdquo; an ankle, etc. Of course, I wasn&amp;rsquo;t
carrying an overwhelming amount of weight (30lbs), and I&amp;rsquo;ve never had any
trouble with my ankles anyway, so your mileage may vary. Still, I personally am
firmly in the camp of those who say that big boots with thick soles that
lace up practically to your knees are actually &lt;em&gt;worse&lt;/em&gt; for your ankles: the make
your ankles weaker by not allowing you to exercise them, and the thicker soles
and tread make it so that if you &lt;em&gt;do&lt;/em&gt; roll an ankle, the displacement will be
much greater than with a more minimal shoe, making it that much more likely that
you&amp;rsquo;ll sustain a real injury. &lt;/p&gt;

&lt;p&gt;That said, the Minimuses (Minimusi?) had two main disadvantages when it comes
to backpacking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The tread does not have much grip at all. I would be hesitant to wear them
on any kind of slick or wet rock, and they were pretty unstable the few times
I had to wade across streams in them. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The pair I wore got pretty torn up over the three days I was on them. They 
have since been relegated to lawn-mowing shoes. The tread is worn down and
torn in several places, and, being white, the dirty stains are pretty much
permanent. I would not trust them to hold up over a longer trip. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One nice thing about the Minimus is that they can be worn fairly comfortably
without socks (I wore them with a pair of liner socks), and they are easy to 
slip on. This makes it practical to put
them on in the middle of the night (glow-in-the-dark!) to answer the call of the
wild without undue effort. &lt;/p&gt;

&lt;p&gt;For a later trip, I tried a pair of La Sportiva Ultra Raptor trail runners, but
found them unwearably painful. Although they are known to run a size small, and
I purchased them a size larger than normal, they were still incredibly tight,
especially in the heel. After wearing them around the house for about an hour,
my feet were numb. They also have plastic projections on the roof of the shoe
that dug into my skin. &lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
&lt;hr&gt;
&lt;ol&gt;

&lt;li id=&quot;fn1&quot;&gt;
&lt;p&gt;&lt;a href=&quot;http://www.tandfonline.com/doi/abs/10.1080/00140138608968276&quot;&gt;Energy cost of backpacking in heavy boots&lt;/a&gt; S. J. Legg , A. Mahanty, Ergonomics, vol. 29, iss. 3, 1986 &amp;nbsp;&lt;a href=&quot;#fnref1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li id=&quot;fn2&quot;&gt;
&lt;p&gt;&lt;a href=&quot;http://www.tandfonline.com/doi/abs/10.1080/00140138408963563&quot;&gt;The energy cost and heart-rate response of trained and untrained subjects walking and running in shoes and boots&lt;/a&gt; Bruce H. Jones, Michael M. Toner, William L. Daniels, Joseph J. Knapik, Ergonomics, vol. 27, iss. 8, 1984  &amp;nbsp;&lt;a href=&quot;#fnref2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li id=&quot;fn3&quot;&gt;
&lt;p&gt;&lt;a href=&quot;http://link.springer.com/article/10.1007/BF00705069#&quot;&gt;Physiological strain due to load carrying in heavy footwear&lt;/a&gt; M. Holewijn, R. Hens, L. J. A. Wammes&amp;nbsp;&lt;a href=&quot;#fnref3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Wed, 08 Jun 2016 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/backpacking/gear/reviews/shoes/2016/06/08/backpacking-shoes.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/backpacking/gear/reviews/shoes/2016/06/08/backpacking-shoes.html</guid>
        
        
        <category>backpacking</category>
        
        <category>gear</category>
        
        <category>reviews</category>
        
        <category>shoes</category>
        
      </item>
    
      <item>
        <title>Per-user customization of GTK2/3 themes</title>
        <description>&lt;p&gt;GTK2 and 3 both use theme to control the appearance of applications that use
them. While an application can override the theme settings in various ways, 
there are also per-user (and even per-application) ways to customize their
appearance and behavior. &lt;/p&gt;

&lt;h2&gt;GTK2&lt;/h2&gt;

&lt;p&gt;For GTK2, theme config files normally reside in 
&lt;code&gt;$XDG_DATA_DIRS/themes/&lt;/code&gt;&lt;em&gt;theme-name&lt;/em&gt;&lt;code&gt;/gtk-2.0/&lt;/code&gt;, so something
like &lt;code&gt;/usr/share/themes/&lt;/code&gt;&lt;em&gt;theme-name&lt;/em&gt;&lt;code&gt;/gtk-2.0/&lt;/code&gt;. The main configuration
file is &lt;code&gt;gtkrc&lt;/code&gt;, with subsidiary files in &lt;code&gt;styles/&lt;/code&gt;. It&amp;rsquo;s worth taking a browse
through the &lt;code&gt;gtkrc&lt;/code&gt; of your favorite theme, to get a feel for how things work.&lt;/p&gt;

&lt;p&gt;Per-user, the &lt;code&gt;gtkrc&lt;/code&gt; can be overridden/augmented with the settings in 
&lt;code&gt;~/.gtkrc-2.0&lt;/code&gt;. This file is loaded after the &lt;code&gt;gtkrc&lt;/code&gt; for your current theme,
so it only needs to specify settings that are different. E.g., mine looks like&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;# Add steppers to scrollbars
style &quot;scrollbar-style&quot; {
    GtkScrollbar::has-backward-stepper = 1  
    GtkScrollbar::has-forward-stepper = 1
}
class &quot;GtkScrollbar&quot; style &quot;scrollbar-style&quot;

# Make sure scrollbars don't warp on click
gtk-primary-button-warps-slider = 0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that the method described below, for GTK3, will also work for GTK2:
you can create a custom theme in &lt;code&gt;~/.themes/&lt;/code&gt;, import the main theme, and
then it will be used in place of it.&lt;/p&gt;

&lt;p&gt;Also note that in GTK2 the &lt;code&gt;rc&lt;/code&gt; file covers both appearance &lt;em&gt;and&lt;/em&gt; 
behavior. E.g., you can use it do to things like create or override keyboard
shortcuts, etc. &lt;/p&gt;

&lt;h2&gt;GTK3&lt;/h2&gt;

&lt;p&gt;GTK3 themes live in &lt;code&gt;$XDG_DATA_DIRS/themes/&lt;/code&gt;&lt;em&gt;theme-name&lt;/em&gt;&lt;code&gt;/gtk-3.0/&lt;/code&gt;, but now 
there are several files to look at: &lt;code&gt;settings.ini&lt;/code&gt; contains various behavior
settings. Then there are probably a bunch of &lt;code&gt;*.css&lt;/code&gt; files; GTK3 loads &lt;code&gt;gtk.css&lt;/code&gt;,
which usually imports a bunch of other files that touch on specific aspects of
the system.&lt;/p&gt;

&lt;p&gt;If you want to override &lt;code&gt;settings.ini&lt;/code&gt;, just put your own in &lt;code&gt;/.config/gtk-3.0/&lt;/code&gt;;
this file will be loaded after the theme&amp;rsquo;s settings, so anything you do here will
replace the theme&amp;rsquo;s settings. Mine looks like&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;[Settings]
gtk-primary-button-warps-slider = false
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Changing settings in the &lt;code&gt;.css&lt;/code&gt; files is a bit more tricky. You can create
&lt;code&gt;~/.themes/&lt;/code&gt;&lt;em&gt;theme-name&lt;/em&gt;&lt;code&gt;/gtk-3.0/gtk.css&lt;/code&gt; but if this file exists the main 
theme file &lt;em&gt;will not be loaded at all&lt;/em&gt;. So you can&amp;rsquo;t just put your changes in
it, or every GTK3 application will load with a mostly empty theme. Instead,
import the main &lt;code&gt;gtk.css&lt;/code&gt; theme you prefer to use at the top of your file, and
then add any customizations below it. E.g., here&amp;rsquo;s what mine looks like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;/* Load the original theme */
@import url(&quot;/usr/share/themes/Mint-X/gtk-3.0/gtk.css&quot;);

/* Override scrollbar setting */
.scrollbar {
    -GtkScrollbar-has-backward-stepper: 1 !important;
    -GtkScrollbar-has-forward-stepper: 1 !important;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Supposedly you can also place a &lt;code&gt;settings.ini&lt;/code&gt; in the same directory as your
customized theme and it will be picked up.&lt;/p&gt;

&lt;h2&gt;Per-application customization&lt;/h2&gt;

&lt;p&gt;Both GTK2 and 3 will try to load some aspects of their theme from files
specified in environment variables, if they are set. You can use this to
override parts of the theme, or switch to a different theme entirely, on a 
per-application basis. &lt;/p&gt;

&lt;p&gt;For GTK2, the variable &lt;code&gt;GTK2_RC_FILES&lt;/code&gt;, if set, will cause all files in the
colon-separated list to be loaded as if they were &lt;code&gt;gtkrc&lt;/code&gt; files, in order.
 I &lt;em&gt;believe&lt;/em&gt; that this 
overrides your per-user file as well, so if you want any per-user settings to
be applied, you&amp;rsquo;ll have to add &lt;code&gt;$HOME/.gtkrc-2.0&lt;/code&gt; to the list, probably at 
the end.&lt;/p&gt;

&lt;p&gt;For GTK3, &lt;code&gt;GTK_THEME&lt;/code&gt; specifies the &lt;code&gt;gtk.css&lt;/code&gt; file to be loaded. You can use
this to either switch to a different theme entirely, or create your own &lt;code&gt;gtk.css&lt;/code&gt;
as above that imports a theme and then overrides a few settings. I&amp;rsquo;m not sure 
if there is a way to override &lt;code&gt;settings.ini&lt;/code&gt; on a per-app basis.&lt;/p&gt;

&lt;p&gt;For GTK3, it&amp;rsquo;s possible to discard themes entirely and go with the default
(ugly) theme, by unsetting &lt;code&gt;GTK_DATA_PREFIX&lt;/code&gt;. E.g.,&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;GTK_DATA_PREFIX= my-application &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;References&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://developer.gnome.org/gtk2/stable/gtk2-Resource-Files.html&quot;&gt;Resource files: GTK+2 Reference Manual&lt;/a&gt; &amp;ndash; 
Describes where resource (rc) files are found, their
format, etc. Unfortunately, there does not appear to be a quick and easy 
reference to all possible per-widget settings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://developer.gnome.org/gtk3/stable/theming.html&quot;&gt;GTK+ CSS: GTK+ 3 Reference Manual&lt;/a&gt; &amp;ndash; 
Reference to the CSS used in GTK3. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://developer.gnome.org/gtk3/stable/gtk3-Bindings.html&quot;&gt;Bindings: GTK3&lt;/a&gt; &amp;ndash;
Reference to the CSS used for assigning key bindings to widgets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://developer.gnome.org/gtk3/stable/GtkCssProvider.html&quot;&gt;GtkCssProvider: GTK3&lt;/a&gt; &amp;ndash;
Describes what CSS files GTK3 will try to load at startup, and in what order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://developer.gnome.org/gtk3/stable/GtkSettings.html&quot;&gt;Settings: GTK3&lt;/a&gt; &amp;ndash;
Describes the paths GTK3 will search for &lt;code&gt;settings.ini&lt;/code&gt; files. Note that the
settings themselves are generally described in the documentation for the 
widgets to which they apply.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 04 May 2016 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/linux/gtk/theme/customization/2016/05/04/per-user-gtk-customization.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/linux/gtk/theme/customization/2016/05/04/per-user-gtk-customization.html</guid>
        
        
        <category>linux</category>
        
        <category>gtk</category>
        
        <category>theme</category>
        
        <category>customization</category>
        
      </item>
    
      <item>
        <title>Buiding Grafx2 on Linux (Ubuntu) from source</title>
        <description>&lt;p&gt;There aren&amp;rsquo;t any instructions for building &lt;a href=&quot;http://pulkomandy.tk/projects/GrafX2&quot;&gt;Grafx2&lt;/a&gt;
from sources on Linux (Ubuntu-derivatives, in particular), and although the
process is not complicated or involved, I thought I&amp;rsquo;d document it, for
posterity. Note that Grafx2 still uses SDL 1.x, not SDL2. If you try to 
build it after installing the SDL2 dev packages, you&amp;rsquo;re going to have a bad
time. &lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;sudo apt-get install libsdl1.2-dev \
                     liblua5.1-0-dev \
                     libpng-dev \
                     libfontconfig1-dev \
                     libsdl-image1.2-dev \
                     libsdl-ttf2.0-dev

svn co svn://pulkomandy.tk/GrafX2

cd Grafx2/trunk/src
make 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you&amp;rsquo;re like me and you don&amp;rsquo;t like installing binaries into &lt;code&gt;/usr/local&lt;/code&gt;, 
then you can install into &lt;code&gt;~/bin&lt;/code&gt; by creating a directory (say, &lt;code&gt;Grafx2&lt;/code&gt;) 
and then copying &lt;code&gt;../bin&lt;/code&gt; and &lt;code&gt;../share&lt;/code&gt; into it. The Grafx2 binary is 
hard-coded to look for its auxilliary files in &lt;code&gt;../share&lt;/code&gt;. &lt;/p&gt;
</description>
        <pubDate>Fri, 18 Mar 2016 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/grafx2/linux/compiling/2016/03/18/building-grafx2-linux.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/grafx2/linux/compiling/2016/03/18/building-grafx2-linux.html</guid>
        
        
        <category>grafx2</category>
        
        <category>linux</category>
        
        <category>compiling</category>
        
      </item>
    
      <item>
        <title>Processing: Locking the mouse</title>
        <description>&lt;p&gt;As part of an example for my game development students (all of my examples
are in &lt;a href=&quot;https://processing.org/&quot;&gt;Processing&lt;/a&gt;), I needed to be able to get 
not just the mouse position, but mouse movement &lt;em&gt;deltas&lt;/em&gt;, whenever the mouse
was moved (I wanted to build an FPS-style mouselook system for them to play
with). In some systems, you can access the raw offsets that are coming from
the mouse, but Java (AWT and JOGL) are not one of those systems. Instead, the
accepted method is to constrain the mouse cursor to the window, hide the mouse
cursor, and then, every time the mouse moves, reset its position to the the
center of the window. So long as the user never moves the mouse fast enough to
hit the edges of the window, this will have the same effect as getting the
raw data. &lt;/p&gt;

&lt;p&gt;For a full-screen sketch, this is relatively easy, regardless of the renderer
in use. You can
use a &lt;code&gt;java.awt.Robot&lt;/code&gt; to set the mouse position to 
&lt;code&gt;(displayWidth/2,displayHeight/2)&lt;/code&gt; in the &lt;code&gt;mouseMoved&lt;/code&gt; handler. &lt;/p&gt;

&lt;p&gt;For a windowed sketch, things are more difficult. A robot will set the mouse
position in &lt;em&gt;screen&lt;/em&gt; coordinates, not window coordinates, so in order to 
center the mouse cursor in the window, you have to know the screen position
of it (along with the size of any chrome around the edges of the window). This
turns out to be surprisingly difficult to get, particularly if you&amp;rsquo;re using the
JAVA2D renderer. &lt;/p&gt;

&lt;p&gt;(I should mention that this method has only been tested with Processing 
3.0.1 248. Due to the propensity of Processing&amp;rsquo;s developers for breaking
backwards compatibility, it&amp;rsquo;s 
entirely possible that everything I&amp;rsquo;m saying here will be obsolete next week.)&lt;/p&gt;

&lt;p&gt;Processing sketches &lt;em&gt;used&lt;/em&gt; to have a global &lt;code&gt;frame&lt;/code&gt; variable containing a 
reference to the AWT frame containing the sketch. As of P3.0, the variable
still exists, but it&amp;rsquo;s not a real frame. A few of its methods have been 
overloaded to give error messages (intended to let the user know that its
use is deprecated), but &lt;code&gt;getLocation()&lt;/code&gt; always returns &lt;code&gt;(0,0)&lt;/code&gt;, while
&lt;code&gt;getLocationOnScreen()&lt;/code&gt; throws an exception (because the frame is not part of
a displayed window hierarchy). In my mind, it would have been better to leave
&lt;code&gt;frame&lt;/code&gt; set to &lt;code&gt;null&lt;/code&gt;, so that &lt;em&gt;any&lt;/em&gt; use of it would trigger an error.&lt;/p&gt;

&lt;p&gt;The trick then is to figure out how to talk to the &amp;ldquo;real&amp;rdquo; window containing the
sketch. The method varies depending on whether you are using P2D or P3D:&lt;/p&gt;

&lt;p&gt;For JAVA2D, the value of the global &lt;code&gt;surface&lt;/code&gt; variable will be a &lt;code&gt;PSurfaceAWT&lt;/code&gt;, which
exposes a &lt;code&gt;getFrame()&lt;/code&gt; method returning the normal AWT frame containing the
sketch. Thus, you can do:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surface&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getFrame&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getLocationOnScreen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;robot&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMousePosition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;(There&amp;rsquo;s also a new (?) 2D renderer based on JavaFX; I haven&amp;rsquo;t looked at what
kind of window it sets up.)&lt;/p&gt;

&lt;p&gt;For P3D (and possibly P2D?) we&amp;rsquo;re in better luck, as the window is actually handled by JOGL, which
has some support routines that do what we want directly. &lt;code&gt;surface.getNative()&lt;/code&gt;
will return a &lt;code&gt;GLWindow&lt;/code&gt; which exposes public methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;confinePointer(boolean)&lt;/code&gt; &amp;ndash; to restrict the pointer to the window&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;warpPointer(int,int)&lt;/code&gt; &amp;ndash; to re-center the pointer position (note that
 this takes &lt;em&gt;window&lt;/em&gt; coordinates!)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;setPointerVisible(boolean)&lt;/code&gt; &amp;ndash; to hide the mouse cursor&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So we can just do&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.jogamp.newt.opengl.GLWindow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;GLWindow&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GLWindow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;surface&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getNative&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;confinePointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setPointerVisible&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;warpPointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Processing has a &amp;ldquo;libraries&amp;rdquo; browser that lets you search for libraries other
people have written, but what it really needs is an examples browser, with 
some kind of automated testing to make sure that examples &lt;em&gt;continue to work&lt;/em&gt; in
newer versions. &lt;/p&gt;
</description>
        <pubDate>Tue, 01 Mar 2016 00:00:00 -0800</pubDate>
        <link>http://twicetwo.com/blog/processing/2016/03/01/processing-locking-the-mouse.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/processing/2016/03/01/processing-locking-the-mouse.html</guid>
        
        
        <category>processing</category>
        
      </item>
    
      <item>
        <title>The life, death, and rebirth of my laptop</title>
        <description>&lt;p&gt;The Dell Precision M4500, which had already given me so much grief died this
morning. It was working fine last night, but this morning it would simply not
power on; no lights, beeps, no indication of life at all. (I&amp;rsquo;m thinking 
motherboard; even though I got myself back up and running, I&amp;rsquo;ll probably order
a replacement, just to get it working again so I can add it to my ever-growing
pile of working-but-unused laptops.) Since this was my primary school &lt;em&gt;and&lt;/em&gt;
development laptop, it was imperative that I get something working. &lt;/p&gt;

&lt;p&gt;(Note that I wasn&amp;rsquo;t worried about data loss. I use &lt;a href=&quot;http://tarsnap.com/&quot;&gt;Tarsnap&lt;/a&gt; 
and have been quite
happy with it, and I was pretty sure the HD was OK in any case; I just needed
a working computer, preferably one with all my stuff on it.)&lt;/p&gt;

&lt;p&gt;I still had my old Thinkpad T61 at home (which the M4500 was intended to
&lt;em&gt;replace&lt;/em&gt;), I figured I&amp;rsquo;d try a simple HD swap. This usually works well on
Linux installs with stock kernels, as the distros tend to include drivers for
everything so that changing hardware isn&amp;rsquo;t an issue. In this case, however, 
I ran into two problems.&lt;/p&gt;

&lt;h2&gt;Things that did not work&lt;/h2&gt;

&lt;p&gt;Setting the boot flag on the protective MBR partition did not work. Setting
the legacy boot flag on the Linux system partition did not work. Installing 
Grub did not work (on GPT Grub needs its own partition to work with, and I 
didn&amp;rsquo;t have room to create one). &lt;/p&gt;

&lt;h2&gt;GPT vs. MBR&lt;/h2&gt;

&lt;p&gt;The M4500 was built to boot via GPT and UEFI; the Thinkpad supports neither. The
first step was to get it booting via the old MBR+BIOS. Although there are 
apparently ways to partition your HD so that both GPT and MBR booting are 
supported, I hadn&amp;rsquo;t done that when I set this system up. That left &lt;em&gt;converting&lt;/em&gt;
the GPT structures to MBR. I only had three partitions, so I didn&amp;rsquo;t expect any
problems, but it&amp;rsquo;s still scary whenever you do something that involves 
blowing away the partition table and building it from scratch. I used a Linux
live USB drive (running Mint 17.1, the same version I&amp;rsquo;m using on the desktop)
and ran &lt;code&gt;sgdisk&lt;/code&gt;. The &lt;code&gt;r&lt;/code&gt; menu contains a &lt;code&gt;g&lt;/code&gt; option to convert GPT to MBR. It
does almost all the work for you: you only have to set the boot flag on your
Linux system partition when it&amp;rsquo;s done.&lt;/p&gt;

&lt;h2&gt;Grub for UEFI vs. MBR&lt;/h2&gt;

&lt;p&gt;The newly-created MBR does not have any bootloader code in it, so I had to 
reinstall Grub. This isn&amp;rsquo;t hard to do from a Live install, but there were
a few quirks. Most tutorials will tell you to mount your existing Linux, 
mount &lt;code&gt;/dev&lt;/code&gt;, &lt;code&gt;/proc&lt;/code&gt; and a few other things into it, and then &lt;code&gt;chroot&lt;/code&gt; in to
run &lt;code&gt;grub-install&lt;/code&gt;. But in my case, I didn&amp;rsquo;t have the &lt;code&gt;x86-pc&lt;/code&gt; Grub modules, 
just the UEFI modules. So I also had to mount in &lt;code&gt;/usr/lib/grub&lt;/code&gt; from the 
flash drive. After that the Grub install/update worked fine. (After booting
my new system, I installed the &lt;code&gt;grub-pc&lt;/code&gt; package so that the modules would 
always be available. This also removed the UEFI modules and reinstalled Grub
 (again!) just to make sure everything is in sync.)&lt;/p&gt;

&lt;h2&gt;The full process&lt;/h2&gt;

&lt;p&gt;Here&amp;rsquo;s a transcript of the full process, run from a live USB drive, &lt;em&gt;after&lt;/em&gt;
converting from GPT to MBR (which is just a matter of running 
&lt;code&gt;sudo gdisk&lt;/code&gt;, then &lt;code&gt;r&lt;/code&gt;, &lt;code&gt;g&lt;/code&gt;, then exit and set the boot flag with the utility
of your choice).&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;mint@mint ~ $ sudo mkdir /mnt/hd        
mint@mint ~ $ sudo mount /dev/sda2 /mnt/hd
mint@mint ~ $ sudo mount --bind /dev /mnt/hd/dev
mint@mint ~ $ sudo mount --bind /dev/pts /mnt/hd/dev/pts
mint@mint ~ $ sudo mount --bind /proc /mnt/hd/proc      
mint@mint ~ $ sudo mount --bind /sys /mnt/hd/sys     
mint@mint ~ $ sudo mount --bind /usr/lib/grub/ /mnt/hd/usr/lib/grub/
mint@mint ~ $ sudo chroot /mnt/hd
mint / # grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
mint / # grub-install --recheck /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
mint / # update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-37-generic
Found initrd image: /boot/initrd.img-3.13.0-37-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
  No volume groups found
done
mint / # exit
mint@mint ~ $ sudo umount /mnt/hd/sys
mint@mint ~ $ sudo umount /mnt/hd/proc
mint@mint ~ $ sudo umount /mnt/hd/dev/pts
mint@mint ~ $ sudo umount /mnt/hd/dev    
mint@mint ~ $ sudo umount /mnt/hd/usr/lib/grub
mint@mint ~ $ sudo umount /mnt/hd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Remaining Issues&lt;/h2&gt;

&lt;p&gt;After all that, I was able to boot my system into X just fine. Only a few 
issues remained: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I had fiddled with the touchpad threshold values (in order to make the 
 M4500&amp;rsquo;s touchpad less insane) and the new values didn&amp;rsquo;t make any sense
 on the Thinkpad. I reset them to &lt;code&gt;FingerLow=10&lt;/code&gt; and &lt;code&gt;FingerHigh=20&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Having a different Wifi adapter means all my remembered connections were 
 forgotten. Aparently the saved connections are keyed to the GUID of the 
 WiFi card itself, which on one hand would allow you to have a separate
 set of connections per card (if you had more than one), but would also mean
 that just replacing your WiFi device would invalidate all your existing 
 connections, too.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I also had some issues with NVidia (as usual), which for now seem to have
 been largely dealt with by adding&lt;/p&gt;

&lt;p&gt;Section &amp;ldquo;Device&amp;rdquo;
            Identifier &amp;ldquo;Quadro NVS 140M&amp;rdquo;
            Driver &amp;ldquo;nvidia&amp;rdquo;
            Option &amp;ldquo;NoLogo&amp;rdquo; &amp;ldquo;1&amp;rdquo;
            Option &amp;ldquo;RenderAccel&amp;rdquo; &amp;ldquo;1&amp;rdquo;
            Option &amp;ldquo;TripleBuffer&amp;rdquo; &amp;ldquo;true&amp;rdquo;
            Option &amp;ldquo;MigrationHeuristic&amp;rdquo; &amp;ldquo;greedy&amp;rdquo;
            Option &amp;ldquo;UseEvents&amp;rdquo; &amp;ldquo;False&amp;rdquo;
        EndSection     &lt;/p&gt;

&lt;p&gt;to &lt;code&gt;/usr/share/X11/xorg.conf.d/20-nvidia.conf&lt;/code&gt;. (&lt;code&gt;NoLogo&lt;/code&gt; is purely
 cosmetic; it just disables the NVidia spash screen when X starts up.
 &lt;code&gt;UseEvents&lt;/code&gt; &lt;em&gt;hopefully&lt;/em&gt; prevents an issue where the NVidia driver fills up
 X&amp;rsquo;s event queue and makes the server hang.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 26 Feb 2016 00:00:00 -0800</pubDate>
        <link>http://twicetwo.com/blog/processing/2016/02/26/life-death-rebirth-of-my-laptop.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/processing/2016/02/26/life-death-rebirth-of-my-laptop.html</guid>
        
        
        <category>processing</category>
        
      </item>
    
      <item>
        <title>TeXLive, TLMGR, and Ubuntu</title>
        <description>&lt;p&gt;This is another nerd post, but don&amp;rsquo;t worry, it&amp;rsquo;s short. I ran into a problem
updating my TeXLive installation, and all the solutions I found on the internet
were misleading. Note that what follows only applies if you installed your 
TeXLive from the install script, not via your distribution&amp;rsquo;s package manager.
In the latter case, the error described below is the intended behavior. (But
really, in order to get the full use out of TeXLive you &lt;em&gt;shouldn&amp;rsquo;t&lt;/em&gt; be using
the repo version, as those tend to be both old and static.)&lt;/p&gt;

&lt;p&gt;If you try to update your TeXLive installation on Debian/Ubuntu, you may get
an error message saying that it&amp;rsquo;s &amp;ldquo;running in user mode&amp;rdquo; and &amp;ldquo;can&amp;rsquo;t initialize
TLPDB&amp;rdquo;. This may surprise you if you, like I, installed TeXLive not via the
package manager but from the install script. The causes of this are two fold:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When you run &lt;code&gt;sudo tlmgr&lt;/code&gt; by default it does not inherit your path, so if
you&amp;rsquo;ve installed TexLive into &lt;code&gt;/opt&lt;/code&gt; or &lt;code&gt;/usr/local&lt;/code&gt; it will not be found.
Normally this would just result in a &amp;ldquo;command not found&amp;rdquo; error except&amp;hellip;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you have &lt;em&gt;also&lt;/em&gt; accidentally installed TeXLive through your package 
manager (e.g., as a dependency of something else), then the &lt;code&gt;tlmgr&lt;/code&gt; that sudo
will find will be that one. And Debian/Ubuntu TeXLive installations are 
built to &lt;em&gt;never&lt;/em&gt; allow updates to be applied globally, only in user mode
(and for good reason: the global set of TeXLive packages is the set that
other packages depend on when they have TeXLive as a dependency). &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The solution is to purge the package manager copy of TeXLive from your system:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;sudo apt-get purge &quot;texlive*&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To run &lt;code&gt;tlmgr&lt;/code&gt; via sudo, you&amp;rsquo;ll either need to explicitly set your path in it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;sudo env &quot;PATH=$PATH&quot; tlmgr update --all
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or else add the path to &lt;code&gt;tlmgr&lt;/code&gt; to the &lt;code&gt;secure_path&lt;/code&gt; setting in &lt;code&gt;/etc/sudoers&lt;/code&gt;.
The latter is probably more secure, as it only allows running of tlmgr and the 
associated
TeXLive tools from sudo, not everything in your path. (If you want to get all
fancy, you could add symlinks to the TeXLive binaries (&lt;code&gt;latex&lt;/code&gt;, etc.) into the
relevant locations, so that you could then force-install any repo packages that
depended on TeXLive, without installing TeXLive.)&lt;/p&gt;

&lt;p&gt;Some of the &lt;em&gt;wrong&lt;/em&gt; suggestions I saw in my search included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&amp;ldquo;Run &lt;code&gt;tlmgr init-usertree&lt;/code&gt; to setup your user TeXLive directories&amp;rdquo;. This won&amp;rsquo;t
work because you almost certainly &lt;em&gt;already&lt;/em&gt; have your usertree setup, so it
will simply do nothing. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install &lt;code&gt;xzdec&lt;/code&gt;. Apparently the repo copy depends on this, but it&amp;rsquo;s not
listed as a dependency. But the non-repo TeXLive does not suffer from this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&amp;ldquo;The behavior is as intended&amp;rdquo; &amp;ndash; For repo-installed copies of TeXLive, yes. 
But not for the manually-installed version.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 13 Nov 2015 00:00:00 -0800</pubDate>
        <link>http://twicetwo.com/blog/nerdstuff/tex/texlive/tlmgr/2015/11/13/texlive-tlmgr-ubuntu.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/nerdstuff/tex/texlive/tlmgr/2015/11/13/texlive-tlmgr-ubuntu.html</guid>
        
        
        <category>nerdstuff</category>
        
        <category>tex</category>
        
        <category>texlive</category>
        
        <category>tlmgr</category>
        
      </item>
    
      <item>
        <title>Linux Mint on a Dell Precision M4500</title>
        <description>&lt;p&gt;A while back I replaced my trustworthy Thinkpad T61 with a Dell Precision
M4500. The only problem I had with the Thinkpad was with Nvidia not liking 
external monitors. (It would restart X when an external monitor was connected,
and then the external would be the default monitor. Any attempt to e.g., clone
both screens or even to change the default back to the LCD panel would just 
crash X again.) Since that&amp;rsquo;s pretty much a deal-breaker for a teacher, I 
decided to &amp;ldquo;upgrade&amp;rdquo; to a Dell Precision. I wanted something in the same
&amp;ldquo;mobile workstation&amp;rdquo; class, with a good (non-chiclet) keyboard and touchpad.
But the Precision has been much more trouble than the Thinkpad ever was 
(although external monitors do work with reasonable reliability). I&amp;rsquo;ve been
gradually working through the issues as I have time.&lt;/p&gt;

&lt;h1&gt;Nvidia Sometimes makes Compiz/X Hang or Crash&lt;/h1&gt;

&lt;p&gt;Sometimes, after logging in, either Compiz will fail to start (leaving me with
un-managed windows) or will fail to render anything (giving a black screen) or
X will hang completely. The former two cases can be &amp;ldquo;solved&amp;rdquo; by killing X 
(or, equivalently, restarting &lt;code&gt;mdm&lt;/code&gt;), but the latter requires a magic-SysRq 
restart. After reading the usual round of irrelevant forum posts and old bug 
reports, I&amp;rsquo;ve tracked down a combination of changes that &lt;em&gt;seem&lt;/em&gt; to mostly solve
the issue. &lt;/p&gt;

&lt;p&gt;Make sure Grub doesn&amp;rsquo;t switch to the graphical console (or tell the
kernel to do the same):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;GRUB_CMDLINE_LINUX=&quot;nouveau.modeset=0&quot;
GRUB_TERMINAL=console
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;(Add to &lt;code&gt;/etc/defaults/grub&lt;/code&gt; and then run &lt;code&gt;update-grub&lt;/code&gt;.) Note that even with
this change the kernel still switches to fbcon halfway through the boot 
process.&lt;/p&gt;

&lt;p&gt;Blacklist the Nouveau kernel module: add a line &lt;code&gt;blacklist nouveau&lt;/code&gt; to 
&lt;code&gt;/etc/modprobe.d/blacklist.conf&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Remove the Nouveau X driver (make sure you have the official Nvidia drivers,
obviously):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;apt-get remove xserver-xorg-video-nouveau 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Also note that if you have to restart X, it may leave a zombie Compiz running
in the background, taking 100% CPU (which, on an 4-core machine, is not even
noticeable). Running &lt;code&gt;top&lt;/code&gt; and then doing &lt;code&gt;kill -9&lt;/code&gt; &lt;em&gt;pid&lt;/em&gt; will fix that; just
make sure you kill the right process.&lt;/p&gt;

&lt;p&gt;A related issue seems to be that sometimes the Mate Panel is displayed on 
screen but not actually mapped, so you can&amp;rsquo;t click on it. Killing the panel
fixes this, but it&amp;rsquo;s annoying.&lt;/p&gt;

&lt;h1&gt;Touchpad is Crazy Sensitive&lt;/h1&gt;

&lt;p&gt;The touchpad was so sensitive I could move the mouse cursor without touching the pad, just 
by hovering my finger over it. Also, the whole &amp;ldquo;disable the mouse while typing&amp;rdquo;
thing doesn&amp;rsquo;t work, which, when combined with the above sensitivity, means that
the mouse cursor likes to jump to random locations in my document while I&amp;rsquo;m
typing.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;evtest&lt;/code&gt; reports some crazy low pressure values: sometimes it will even report
movement events with &lt;em&gt;zero&lt;/em&gt; pressure. Although the Synaptics driver supports
setting min/max thresholds for pressure that will register as &lt;em&gt;clicks&lt;/em&gt;, I haven&amp;rsquo;t
yet figured out if it supports just an overall &amp;ldquo;ignore all events below this
pressure&amp;rdquo; threshold.&lt;/p&gt;

&lt;p&gt;The following settings (in &lt;code&gt;.xinitrc&lt;/code&gt;) is supposed to fix the sensitivity:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;synclient FingerLow=83
synclient FingerHigh=88
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But it just has the effect of making the touchpad less sensitive to 
&lt;em&gt;intentional&lt;/em&gt; presses. Accidental touches seem to occur just as often. There 
doesn&amp;rsquo;t seem to be a single setting that will set a minimum threshold for 
pressure to register &lt;em&gt;at all&lt;/em&gt; (i.e., as either move or press events).&lt;/p&gt;

&lt;p&gt;Note that some people recommend changing the &amp;ldquo;FingerPress&amp;rdquo; setting, but that
has been removed from newer versions of the driver.&lt;/p&gt;

&lt;p&gt;For me, checking the box in the mouse settings that says &amp;ldquo;Disable while typing&amp;rdquo;
has no effect. I had to add &lt;code&gt;syndaemon -i 0.5s -d&lt;/code&gt; to my startup script manually
to disable the touchpad while I&amp;rsquo;m typing. &lt;/p&gt;

&lt;h1&gt;Dell&amp;rsquo;s UEFI Implementation is Beyond Broken&lt;/h1&gt;

&lt;p&gt;Going into the BIOS setup at all completely breaks the normal UEFI boot order.
In order to boot back into Linux afterward I have to hit F12 to bring up the
boot menu, and manually select the &lt;code&gt;ubuntu&lt;/code&gt; EFI option. It doesn&amp;rsquo;t matter that
&lt;code&gt;ubuntu&lt;/code&gt; is set as the first, or only, boot entry; if I let the boot go through
without my intervention it will hang at a black screen (pre-Grub). The &amp;ldquo;solution&amp;rdquo;
involves using &lt;code&gt;efibootmgr&lt;/code&gt; to change the boot order so that the &lt;code&gt;ubuntu&lt;/code&gt; 
entry is &lt;em&gt;not&lt;/em&gt; first in the list, but comes after some &lt;em&gt;inactive&lt;/em&gt; entry;
in my case, the first entry is that of legacy boot for the very same HD hosting
Mint. (The &amp;ldquo;Modular Bay HD&amp;rdquo; has Windows 7; it&amp;rsquo;s replacing the DVDRW drive that
would normally be in the expansion bay.) Note that this 
change &lt;em&gt;cannot&lt;/em&gt; be made through BIOS; although the BIOS utility will show what
are apparently the same settings, they won&amp;rsquo;t work. Here&amp;rsquo;s what the
output of &lt;code&gt;efibootmgr -v&lt;/code&gt; looks like (with my system currently booting direct
into Linux):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;BootCurrent: 0005
Timeout: 0 seconds
BootOrder: 0008,0005,0006
Boot0000  Diskette Drive    BIOS(1,0,00)
Boot0001  Internal HDD  BIOS(2,0,00)P0: Crucial_CT256MX100SSD1    .
Boot0002  USB Storage Device    BIOS(5,0,00)USB Storage Device.
Boot0003  CD/DVD/CD-RW Drive    BIOS(3,0,00)
Boot0004  Onboard NIC   BIOS(6,0,00)
Boot0005* ubuntu    HD(1,800,100000,4c57ed8c-a81a-4074-9270-85c4a244fd60)File(\EFI\ubuntu\shimx64.efi)
Boot0006* Modular Bay HDD   BIOS(2,0,00)SATA: ST9250410AS             .
Boot0008  Internal HDD  BIOS(2,0,00)SATA: Crucial_CT256MX100SSD1  .
Boot0009* USB Storage Device    BIOS(5,0,00)
BootFFFA* Internal Shell        Vendor(5990c250-676b-4ff7-8a0d-529319d0b254,)
BootFFFB* Diagnostic Boot       Vendor(5990c250-676b-4ff7-8a0d-529319d0b254,)
BootFFFC* Temporary Boot Menu   Vendor(5990c250-676b-4ff7-8a0d-529319d0b254,)
BootFFFD* Graphic Setup         Vendor(5990c250-676b-4ff7-8a0d-529319d0b254,)
BootFFFE* Text Setup            Vendor(5990c250-676b-4ff7-8a0d-529319d0b254,)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that you will have to manually restore this boot order if you do anything
that might change or reset it, such as upgrading grub. Merely changing the
grub config (&lt;code&gt;update-grub&lt;/code&gt;) is fine, however.&lt;/p&gt;

&lt;p&gt;I should note that Dell&amp;rsquo;s implementation is just flaky in general: It seems to
largely ignore the boot order specified in EFI, and even though it reports
supporting the EFI shell, it will refuse to boot into it. You also cannot 
use BootNext to tell it to launch (e.g.) BIOS setup on next restart. And it 
will restore some EFI settings on startup, overwriting any changes you&amp;rsquo;ve made:
you cannot remove the boot entries for physical drives, and they will 
automatically be added to the BootOrder. (I&amp;rsquo;ve actually both deleted entries
0006 and 0008, and removed them from the boot order. They were restored and 
re-added after a restart. There used to be a 0007 entry; it&amp;rsquo;s missing this boot
for some inexplicable reason.)&lt;/p&gt;

&lt;p&gt;(Note that you can&amp;rsquo;t use &lt;code&gt;efibootmgr&lt;/code&gt; to modify the UEFI boot settings unless
the system was booted in EFI mode. This means that if you started the system
in legacy mode (e.g., to run a live CD) you cannot use it to fix your boot 
settings. But many newer live CD/USB distributions can also be booted in EFI
mode; it&amp;rsquo;s just something to be aware of.)&lt;/p&gt;

&lt;h1&gt;Performance&lt;/h1&gt;

&lt;p&gt;Despite being objectively faster (both in terms of clock speed, and core count)
and having more memory
than my T61, the Precision is noticeably slower. This is with the same model SSD
that I had in my T61. I haven&amp;rsquo;t managed to track this down.&lt;/p&gt;
</description>
        <pubDate>Tue, 27 Oct 2015 00:00:00 -0700</pubDate>
        <link>http://twicetwo.com/blog/linux/hardware/configuration/2015/10/27/linux-mint-dell-precision.html</link>
        <guid isPermaLink="true">http://twicetwo.com/blog/linux/hardware/configuration/2015/10/27/linux-mint-dell-precision.html</guid>
        
        
        <category>linux</category>
        
        <category>hardware</category>
        
        <category>configuration</category>
        
      </item>
    
  </channel>
</rss>
