blog ala arowlacivic hacking and big-ish dataJekyll2018-06-08T19:00:04-04:00http://alisonrowland.com/Alison Rowlandhttp://alisonrowland.com/alisonrowland@gmail.com Extra ESC; Windows Key -> XFCE Menu]]>http://alisonrowland.com/articles/xubuntu-make-caps-lock-extra-escape2016-01-27T00:00:00-05:002016-01-27T00:00:00-05:00Alison Rowlandhttp://alisonrowland.comalisonrowland@gmail.com<p><em>I recently installed Xubuntu on my old Thinkpad T410s, in the hopes that it would be a lighter and faster distribution for my aging, beloved, but soon to be replaced workhorse.
I am not particularly enjoying the experience after several years of Linux Mint, but that is for another post.</em></p>
<p>Mapping CapsLock to Escape is an essential step for vim users. This is covered by an easy keyboard tweaks submenu in Mint, but not so in Xubuntu. It took some searching, trial and error to find
a working command. In Session and Startup, add an item:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xmodmap -e "clear Lock" -e "keysym Caps_Lock = Escape"
</code></pre></div></div>
<p>Another handy trick is setting up a shortcut on the Windows key to open the XFCE applications menu. There are several app menu and search options in XFCE. The one provided here
will bring up the same menu as when you click the XFCE mouse logo in the corner of the panel. Go to <code class="highlighter-rouge">Keyboard</code> -&gt; <code class="highlighter-rouge">Application Shortcuts</code>, click the <code class="highlighter-rouge">Add</code> button, and enter:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xfce4-popup-whiskermenu
</code></pre></div></div>
<p>Click <code class="highlighter-rouge">OK</code> and then hit the Windows key to define it as the shortcut key. That’s it!</p>
<p><a href="http://alisonrowland.com/articles/xubuntu-make-caps-lock-extra-escape">Xubuntu Keyboard Mod Essentials: CapsLock -> Extra ESC; Windows Key -> XFCE Menu</a> was originally published by Alison Rowland at <a href="http://alisonrowland.com">blog ala arowla</a> on January 27, 2016.</p>http://alisonrowland.com/articles/check-your-version-of-nodejs-if-you-get-this-error2013-10-10T00:00:00-04:002013-10-10T00:00:00-04:00Alison Rowlandhttp://alisonrowland.comalisonrowland@gmail.com<p>I am sharing a head-desk moment that I had yesterday, in hopes that it could help somebody. The CSS on this new blog of mine wasn’t updating after changing the <a href="http://lesscss.org/">Less</a> files. This blog runs on <a href="http://jekyllrb.com/">Jekyll</a> with the <a href="http://mademistakes.com/articles/minimal-mistakes-jekyll-theme.html">Minimal Mistakes</a> theme, and I hadn’t yet tried to tweak the CSS (as evidenced by the many rough edges around this place). Turns out, I needed to run <a href="http://gruntjs.com/">Grunt</a> to update the CSS, so I installed Grunt, installed the rest of the project’s package dependencies from ‘packages.json’, and hoped for the best: that grunt would start recompiling my CSS.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm install -g grunt
npm install
$ grunt
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #&lt;Object&gt; has no method 'existsSync'
</code></pre></div></div>
<p>Oops. Long story short, if you get this error out of a Node app, check your versions on everything. I checked npm (1.3.8). Good. I checked grunt (0.4). Good. Then I checked node.js. 0.6.12. <em>Ancient.</em> That’s what I get for relying on Linux Mint 13’s outdated packages for Node. Installing the latest binaries (0.10.20) fixed it right up.</p>
<blockquote>
<p>And that’s why you should always check your package versions!</p>
</blockquote>
<p><em>This was particularly a head-desk moment because I had discovered earlier in the day that I was still running an older and buggy version of <a href="http://betterthangrep.com">ack</a>.</em></p>
<p><a href="http://alisonrowland.com/articles/check-your-version-of-nodejs-if-you-get-this-error">Check Your Version of NodeJS If You Get This Error</a> was originally published by Alison Rowland at <a href="http://alisonrowland.com">blog ala arowla</a> on October 10, 2013.</p>http://alisonrowland.com/articles/the-linux-users-osx-survival-guide2013-10-08T00:00:00-04:002013-10-08T00:00:00-04:00Alison Rowlandhttp://alisonrowland.comalisonrowland@gmail.com<h2 id="or-how-to-get-work-done-on-a-mac-if-youre-a-linux-junky">(Or… how to get work done on a Mac if you’re a Linux junky.)</h2>
<p>While normally a Linux user, my <a href="http://www.whitehouse.gov/innovationfellows">current employer</a> has very kindly (and through great institutional effort) supplied me with a gorgeous MacBook Air. I was a Mac user about eight years ago (OSX Tiger!), but switched to Linux full-time a couple years after that, when I realized I just felt more productive in that environment.</p>
<p>The few can’t live without ‘em features for me in Linux include:</p>
<ol>
<li>Remapping CapsLock to Esc (for vim).</li>
<li>The select to copy, middle click to paste clipboard.</li>
<li>Middle click to open a new browser tab.</li>
</ol>
<p>We’ll tackle them one-by-one.</p>
<h3 id="remapping-capslock-to-esc-in-os-x">Remapping CapsLock to Esc in OS X</h3>
<p>You’ll need <a href="https://pqrs.org/macosx/keyremap4macbook/pckeyboardhack.html">PCKeyboardHack</a> for this one. It will allow you to change the code generated by the CapsLock key. Set it to <code class="highlighter-rouge">53</code>. The PCKeyboardHack site also says you should go in the OS X system preferences (System Prefs. &gt; Keyboard &gt; Modifier Keys) and set the CapsLock key to “No Action” to avoid experiencing a delay, although I didn’t find it necessary and haven’t noticed any sluggishness.</p>
<h3 id="emulating-linuxs-selectcopy-middle-clickpaste">Emulating Linux’s Select/Copy Middle-Click/Paste</h3>
<p>This little-known feature is totally a killer app. One-handed copy and paste with no keyboard input needed. Alternatively, if your hand ends up away from the mouse, you can also hit <code class="highlighter-rouge">Shift-Insert</code> to paste from Linux’s special clipboard. I am lost without it. The directions I found online are a bit confused, but after some trial and error, I got it working: select and three-finger tap to paste in <a href="http://www.iterm2.com/">iTerm2</a>.</p>
<p>First, you need to set up the association between three-finger tap and middle click in iTerm. Go to iTerm &gt; Preferences &gt; Pointer. At the bottom, under “Miscellaneous Settings” check the box “Three-finger tap reports middle click to apps.” But that alone doesn’t seem to do the trick. In order to get this working, I had to install and keep <a href="http://clement.beffa.org/labs/projects/middleclick/">MiddleClick (for Mountain Lion)</a> running in my system tray.</p>
<p>Two-finger drag to select still has horrible performance in iTerm, however. Please tweet at me if you have an answer for that!</p>
<h3 id="three-finger-tap-to-open-a-new-browser-tab">Three-Finger Tap to Open a New Browser Tab</h3>
<p>Surprise! This one got fixed as a side-effect of installing MiddleClick. You’re welcome. :)</p>
<hr />
<p><em>I am writing this post about a month after resolving these issues, so please <a href="http://twitter.com/arowla">let me know</a> if anything here didn’t work out for you, and I will investigate my system settings further.</em></p>
<hr />
<p><em>Thanks to my friend <a href="http://konklone.com">Eric Mill</a> for the idea for the name of this post.</em></p>
<p><a href="http://alisonrowland.com/articles/the-linux-users-osx-survival-guide">The Linux User's OS X Survival Guide</a> was originally published by Alison Rowland at <a href="http://alisonrowland.com">blog ala arowla</a> on October 08, 2013.</p>http://alisonrowland.com/articles/installing-opengrok-on-ubuntu-java-target-version-error2013-10-07T00:00:00-04:002013-10-07T00:00:00-04:00Alison Rowlandhttp://alisonrowland.comalisonrowland@gmail.com<p>Earlier today, I installed Solr on top of OpenJDK 1.6, running Tomcat 6. That went just fine, but I ran into trouble later, when I tried to install <a href="http://opengrok.github.io/OpenGrok/">OpenGrok</a>, which <a href="https://github.com/OpenGrok/OpenGrok/wiki/How-to-build-OpenGrok-from-source">requires JDK 1.7</a>. When I ran <code class="highlighter-rouge">ant</code>, I got this error:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>-do-compile:
[javac] Compiling 245 source files to /usr/local/src/OpenGrok/build/classes
[javac] javac: invalid target release: 1.7
</code></pre></div></div>
<p>This was strange, since at the suggestion of <a href="http://stackoverflow.com/questions/4956209/problem-in-ant-build-invalid-target-release">this StackOverflow answer</a>, I put this line <em>after my opening &lt;project&gt; tag of build.xml</em></p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;echo message="Using Java version ${ant.java.version}."/&gt;
</code></pre></div></div>
<p>And the result was that I was already running 1.7. After a lot of trial and error, I got it to work by running <code class="highlighter-rouge">update-alternatives</code> to officially set the java version to 1.7.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
</code></pre></div></div>
<p>Hopefully this can help out some other Java sysadmin neophytes.</p>
<p><a href="http://alisonrowland.com/articles/installing-opengrok-on-ubuntu-java-target-version-error">Installing OpenGrok on Ubuntu (Java Target Version Error)</a> was originally published by Alison Rowland at <a href="http://alisonrowland.com">blog ala arowla</a> on October 07, 2013.</p>http://alisonrowland.com/articles/installing-pycuda-via-pip2013-10-06T00:00:00-04:002013-10-06T00:00:00-04:00Alison Rowlandhttp://alisonrowland.comalisonrowland@gmail.com<p>I’m currently configuring an Ubuntu server with an <a href="http://www.nvidia.com/object/tesla-supercomputing-solutions.html">NVidia Tesla</a> GPU unit.</p>
<p>In the interest of actually getting things done with it, we are going to try out the <a href="http://mathema.tician.de/software/pycuda">PyCUDA</a> library.</p>
<p>The <a href="http://wiki.tiker.net/PyCuda/Installation/Linux">PyCUDA Installation Docs</a> for Linux don’t refer to installation via pip, but I wanted to give it a try. It mostly went without a hitch, except for a couple of things.</p>
<p>You’ll need to make sure that the cuda <code class="highlighter-rouge">bin</code> directory is on the system path.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export PATH=/usr/local/cuda/bin:$PATH
</code></pre></div></div>
<p>Then you’ll need to install numpy, which also requires having Python’s dev package installed.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt-get install python-dev
pip install numpy
</code></pre></div></div>
<p>At this point, if you run</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pip install pycuda
</code></pre></div></div>
<p>You will get an error:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>In file included from src/cpp/cuda.cpp:1:0:
src/cpp/cuda.hpp:12:18: fatal error: cuda.h: No such file or directory
compilation terminated.
</code></pre></div></div>
<p>This had me confounded, partially due to pycuda’s frequent exhortations in the install logging to run the configure script and Ctrl-C if certain things weren’t what I wanted, etc. But most of the warnings were moot, since pip removes the build directory if you cancel the install (I’m sure there’s some way around this), blocking manual access to the configure script, and there did not seem to be a way to pass configure flags through pip (would also love to learn if you can do this). But then I found this little gem at the beginning of the <a href="http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu">Ubuntu-flavored install docs</a>:</p>
<blockquote>
<p>You’ll need $CUDA_ROOT set to the root of the CUDA install directory</p>
</blockquote>
<p>Set CUDA_ROOT and you should be good to go!</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export CUDA_ROOT=/usr/local/cuda
</code></pre></div></div>
<p><a href="http://alisonrowland.com/articles/installing-pycuda-via-pip">Installing PyCUDA on Ubuntu via pip</a> was originally published by Alison Rowland at <a href="http://alisonrowland.com">blog ala arowla</a> on October 06, 2013.</p>