<?xml version='1.0' encoding='utf-8' ?>
<feed xmlns='http://www.w3.org/2005/Atom'>
  <title type='text'>Muddygoat.org</title>
  <generator uri='http://effectif.com/nesta'>Nesta</generator>
  <id>tag:www.muddygoat.org,2009:/</id>
  <link href='http://www.muddygoat.org/articles.xml' rel='self' />
  <link href='http://www.muddygoat.org' rel='alternate' />
  <subtitle type='text'>A place for things</subtitle>
  <updated>2011-04-12T00:00:00+00:00</updated>
  <author>
    <name>Peter Lewis</name>
    <uri>http://www.muddygoat.org</uri>
    <email>pete@muddygoat.org</email>
  </author>
  <entry>
    <title>Removing the delay in switching Vim modes in tmux.</title>
    <link href='http://www.muddygoat.org/articles/vim-in-tmux' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-04-12:/articles/vim-in-tmux</id>
    <content type='html'>
      &lt;p&gt;I&amp;#8217;ve had a real annoyance with console Vim for a while now, which I just haven&amp;#8217;t been able to figure out. Today I did.&lt;/p&gt;
      
      &lt;p&gt;When you&amp;#8217;re in insert mode, you hit escape to leave and go back to normal mode. However, due to the way that terminals often map escape characters, when you hit escape, the terminal can wait around for a second, just in case you wanted to press another key and complete the escape mapping. But, this means that every time I wanted to leave insert mode, I was having to wait for around a second. If I didn&amp;#8217;t, then Vim instead inserted some sort of symbol like&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;ä&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;instead of doing&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Esc d d&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;to leave insert mode and delete the current line.&lt;/p&gt;
      
      &lt;p&gt;I tried a few things, including reducing Vim&amp;#8217;s &lt;code&gt;timeoutlen&lt;/code&gt;, which appeared to have no effect.&lt;/p&gt;
      
      &lt;p&gt;This really interrupted my flow, and led me to use graphical Vim much more than console Vim, since the problem didn&amp;#8217;t happen there. But today I found that it wasn&amp;#8217;t happening outside of tmux at all. So, must be tmux&amp;#8217;s problem.&lt;/p&gt;
      
      &lt;p&gt;The solution lies in telling tmux not to wait. I stuck the following in my &lt;code&gt;.tmux&lt;/code&gt; file:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;set -sg escape-time 0&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;And now hitting escape exits insert mode instantly, even in tmux!&lt;/p&gt;
    </content>
    <published>2011-04-12T00:00:00+00:00</published>
    <updated>2011-04-12T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='tmux'></category>
    <category term='vim'></category>
  </entry>
  <entry>
    <title>Bulldozing Java's classpath system to just make stuff work.</title>
    <link href='http://www.muddygoat.org/articles/autojar' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-04-01:/articles/autojar</id>
    <content type='html'>
      &lt;p&gt;If you use Java, then you&amp;#8217;ll know it has this horrible (in my view) classpath concept, which usually just means more work to get something running (again in my experience.)&lt;/p&gt;
      
      &lt;p&gt;I came across this problem the other day when trying to run someone else&amp;#8217;s code, which was arranged neatly into projects, packages etc., each of which built to a separate .jar file in its own subdirectory&amp;#8230; ugh. (In case you haven&amp;#8217;t realised yet, I don&amp;#8217;t much like Java!)&lt;/p&gt;
      
      &lt;p&gt;Anyway, yesterday I stumbled upon this little nugget, which makes running something structured like this a breeze.&lt;/p&gt;
      
      &lt;p&gt;First, stick this line in a script in the root directory of the Java project:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;find . -name &amp;#39;*.jar&amp;#39; | tr &amp;#39;[:space:]&amp;#39; &amp;#39;:&amp;#39; | sed -e &amp;#39;s/:$//g&amp;#39; &amp;gt; classpath&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;which finds all the .jar files in any subdirectory, lists them, formats them suitably for Java to understand and sticks them in the file &amp;#8220;classpath&amp;#8221;.&lt;/p&gt;
      
      &lt;p&gt;Second, run the program like this, using the newly generated &amp;#8220;classpath&amp;#8221; file to tell the virtual machine where to look:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;java -cp `cat classpath` example.Main&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Thanks to &lt;a href='http://cefn.com'&gt;Cefn Hoile&lt;/a&gt; for &lt;a href='http://cefn.com/blog/autojar.html'&gt;the tip&lt;/a&gt;!&lt;/p&gt;
    </content>
    <published>2011-04-01T00:00:00+00:00</published>
    <updated>2011-04-01T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='java'></category>
  </entry>
  <entry>
    <title>pacgem: managing Ruby gems in Archlinux with ease.</title>
    <link href='http://www.muddygoat.org/articles/pacgem' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-03-23:/articles/pacgem</id>
    <content type='html'>
      &lt;p&gt;Ruby is great. It&amp;#8217;s also designed to be platform independent and highly modular (i.e. through its gems system). The need to manage the gems and dependencies between them led to the development of its own package manager, &lt;em&gt;rubygems&lt;/em&gt;, which works on any platform that can run ruby. However, here&amp;#8217;s the problem: what if your system already has a very good package manager (i.e. &lt;em&gt;pacman&lt;/em&gt;)? Well, then you probably don&amp;#8217;t want to allow other things to start messing with what&amp;#8217;s in your file system.&lt;/p&gt;
      
      &lt;p&gt;One approach to dealing with this is to create a PKGBUILD for each and every gem (there are a few already in the &lt;a href='http://aur.archlinux.org/'&gt;AUR&lt;/a&gt;), but there are far more gems than can feasibly done by hand, and also unless an AUR helper which handles dependencies is used, it can be quite tiresome installing them all one by one. This solution is really not scalable, given the number of ruby gems that exist (22,366 according to &lt;a href='http://www.rubygems.org/'&gt;rubygems.org&lt;/a&gt;).&lt;/p&gt;
      
      &lt;p&gt;Enter &lt;em&gt;pacgem&lt;/em&gt;! This was created by minad and announced &lt;a href='https://bbs.archlinux.org/viewtopic.php?id=113123'&gt;here&lt;/a&gt; on the Archlinux BBS.&lt;/p&gt;
      
      &lt;p&gt;It seems to me that pacgem makes managing ruby gems in Archlinux an absolute breeze. Basically, it creates a custom PKGBUILD for the specified gem, on the fly, handling dependencies between gems automatically.&lt;/p&gt;
      
      &lt;p&gt;Observe:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;% pacgem nesta&amp;#x000A;&amp;#x000A;==&amp;gt; Saving package files in /home/pete/arch/builds/pacgem/ruby-bundler&amp;#x000A;==&amp;gt; Resolving gems...&amp;#x000A;  -&amp;gt; (New) nesta-0.9.4: Ruby CMS, written in Sinatra&amp;#x000A;  -&amp;gt; (New) haml-3.0.25: An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine.&amp;#x000A;  -&amp;gt; (New) maruku-0.6.0: Maruku is a Markdown-superset interpreter written in Ruby.&amp;#x000A;  -&amp;gt; (New) syntax-1.0.0: Syntax is Ruby library for performing simple syntax highlighting.&amp;#x000A;  -&amp;gt; (New) RedCloth-4.2.7: RedCloth-4.2.7&amp;#x000A;  -&amp;gt; (New) sinatra-1.1.2: Classy web-development dressed in a DSL&amp;#x000A;  -&amp;gt; (New) rack-1.2.2: a modular Ruby webserver interface&amp;#x000A;  -&amp;gt; (New) tilt-1.2.2: Generic interface to multiple Ruby template engines&amp;#x000A;  -&amp;gt; (New) shotgun-0.9: reloading rack development server&amp;#x000A;==&amp;gt; Making package: ruby-haml 3.0.25-1 (Tue Mar 22 19:23:59 GMT 2011)&amp;#x000A;==&amp;gt; WARNING: Skipping dependency checks.&amp;#x000A;==&amp;gt; Retrieving Sources...&amp;#x000A;  -&amp;gt; Found haml-3.0.25.gem&amp;#x000A;==&amp;gt; Validating source files with sha256sums...&amp;#x000A;    haml-3.0.25.gem ... Passed&amp;#x000A;==&amp;gt; Extracting Sources...&amp;#x000A;==&amp;gt; Entering fakeroot environment...&amp;#x000A;==&amp;gt; Starting build()...&amp;#x000A;==&amp;gt; Installing gem...&amp;#x000A;Successfully installed haml-3.0.25&amp;#x000A;1 gem installed&amp;#x000A;==&amp;gt; Fixing gem installation...&amp;#x000A;==&amp;gt; Tidying install...&amp;#x000A;  -&amp;gt; Purging other files...&amp;#x000A;  -&amp;gt; Compressing man and info pages...&amp;#x000A;  -&amp;gt; Stripping unneeded symbols from binaries and libraries...&amp;#x000A;  -&amp;gt; Removing empty directories...&amp;#x000A;==&amp;gt; Creating package...&amp;#x000A;  -&amp;gt; Generating .PKGINFO file...&amp;#x000A;  -&amp;gt; Compressing package...&amp;#x000A;==&amp;gt; Leaving fakeroot environment.&amp;#x000A;==&amp;gt; Finished making: ruby-haml 3.0.25-1 (Tue Mar 22 19:24:03 GMT 2011)&amp;#x000A;==&amp;gt; Checking ruby-haml-3.0.25-1-any.pkg.tar.xz with namcap...&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;A short while and several pages of text later, the nesta gem and all the other gems it depends on are installed!&lt;/p&gt;
      
      &lt;p&gt;And, crucially, all the files are still under the management of pacman, each gem with its own package. E.g.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;% pacman -Qo /usr/lib/ruby/gems/1.9.1/gems/nesta-0.9.4/Gemfile&amp;#x000A;&amp;#x000A;/usr/lib/ruby/gems/1.9.1/gems/nesta-0.9.4/Gemfile is owned by ruby-nesta 0.9.4-1&amp;#x000A;&amp;#x000A;% pacman -Qo /usr/lib/ruby/gems/1.9.1/gems/haml-3.0.25/Rakefile&amp;#x000A;&amp;#x000A;/usr/lib/ruby/gems/1.9.1/gems/haml-3.0.25/Rakefile is owned by ruby-haml 3.0.25-1&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Nice! Thanks minad!&lt;/p&gt;
    </content>
    <published>2011-03-23T00:00:00+00:00</published>
    <updated>2011-03-23T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='ruby'></category>
  </entry>
  <entry>
    <title>BBC Radio in Amarok.</title>
    <link href='http://www.muddygoat.org/articles/bbc-radio-amarok' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2008-12-21:/articles/bbc-radio-amarok</id>
    <content type='html'>
      &lt;p&gt;I recently came across a &lt;a href='http://www.linuxforums.org/forum/gaming-games-multimedia-entertainment/79340-howto-use-amarok-play-bbc-radio-stations-over-internet.html'&gt;forum discussion&lt;/a&gt; describing how to listen to the BBC&amp;#8217;s broadcast radio stations over the Internet in &lt;a href='http://amarok.kde.org/'&gt;Amarok&lt;/a&gt;. For a while now, we&amp;#8217;ve had the ability to listen to the BBC through their web-based service, but I&amp;#8217;m usually a fan of things which bring things together in one place. And, call me old fashioned, but to be frank I&amp;#8217;d rather listen to music in my music player, and read web pages in my web browser.&lt;/p&gt;
      
      &lt;p&gt;Anyway, the instructions for how to do this are as follows:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;
      &lt;p&gt;On the left hand side of the Amarok window, select &amp;#8220;playlists&amp;#8221; to open up the playlist selector in the side panel.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Select &amp;#8220;my playlists&amp;#8221; in this side panel, then &amp;#8220;add stream&amp;#8221;.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;You&amp;#8217;ll have to add a stream for each radio station you want to be able to access. So, write the name you&amp;#8217;d like to refer to this station (e.g. &amp;#8220;Radio 1&amp;#8221;) in the &amp;#8220;name&amp;#8221; box.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;In the &amp;#8220;stream URL&amp;#8221; box, copy the URL of the relevant stream, from the list below, and press &amp;#8220;OK&amp;#8221;.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;You can then add the newly created stream to your playlist, and it should play the live radio station!&lt;/p&gt;
      &lt;/li&gt;
      &lt;/ul&gt;
      
      &lt;p&gt;The stream for each radio station is as follows:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;
      &lt;p&gt;Radio 1: &lt;code&gt;mms://wmlive-acl.bbc.co.uk/wms/radio1/radio1_nb_e1s1&lt;/code&gt;&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Radio 2: &lt;code&gt;mms://wmlive-acl.bbc.co.uk/wms/radio2/radio2_nb_e1s1&lt;/code&gt;&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Radio 3: &lt;code&gt;mms://wmlive-acl.bbc.co.uk/wms/radio3/radio3_nb_e1s1&lt;/code&gt;&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Radio 4: &lt;code&gt;mms://wmlive-acl.bbc.co.uk/wms/radio4/radio4_nb_e1s1&lt;/code&gt;&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;BBC 7: &lt;code&gt;mms://wmlive.bbc.co.uk/wms/bbc7/lo_s1&lt;/code&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;/ul&gt;
      &lt;!-- Enjoy... and if anyone has any more stream URLs then &lt;a href=&quot;http://www.muddygoat.org/getintouch&quot;&gt;email them to me&lt;/a&gt; and I'll add them to this list.&lt;/p&gt; --&gt;
    </content>
    <published>2008-12-21T00:00:00+00:00</published>
    <updated>2008-12-21T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='amarok'></category>
    <category term='bbc'></category>
  </entry>
  <entry>
    <title>How to connect to eduroam with netcfg.</title>
    <link href='http://www.muddygoat.org/articles/netcfg-eduroam' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2008-10-27:/articles/netcfg-eduroam</id>
    <content type='html'>
      &lt;p&gt;I&amp;#8217;m now using ArchLinux, and having got a configuration which connects nicely to the fast-growing academic federal wireless network, eduroam. So if you have a login for eduroam, this might be of use to you.&lt;/p&gt;
      
      &lt;p&gt;Firstly, install netconfig and wpa_supplicant:&lt;/p&gt;
      
      &lt;p&gt;pacman -S netcfg wpa_supplicant&lt;/p&gt;
      
      &lt;p&gt;Then, add a profile for eduroam. To do this, create the file in /etc/network.d/eduroam and put the following in it:&lt;/p&gt;
      
      &lt;p&gt;CONNECTION=&amp;#8221;wireless&amp;#8221; INTERFACE=wlan0 SCAN=&amp;#8221;no&amp;#8221; SECURITY=&amp;#8221;wpa-config&amp;#8221; ESSID=&amp;#8221;eduroam&amp;#8221; IP=&amp;#8221;dhcp&amp;#8221; TIMEOUT=30 WPA_CONF=&amp;#8221;/etc/wpa_supplicant.conf&amp;#8221;&lt;/p&gt;
      
      &lt;p&gt;Note the lower case letters. Oh, and make sure that you replace wlan0 with the name of your wireless networking device. If you&amp;#8217;re not sure, typing iwconfig at the terminal should show you.&lt;/p&gt;
      
      &lt;p&gt;Now, create (or open) the file /etc/wpa_supplicant.conf and add the following to it:&lt;/p&gt;
      
      &lt;p&gt;ctrl_interface=/var/run/wpa_supplicant eapol_version=1 ap_scan=1 fast_reauth=1&lt;/p&gt;
      
      &lt;p&gt;network={ ssid=&amp;#8221;eduroam&amp;#8221; key_mgmt=IEEE8021X WPA-NONE WPA-EAP eap=PEAP identity=&amp;#8221;abc123@institution.ac.uk&amp;#8221; password=&amp;#8221;XXXXXXXXXXXX&amp;#8221; ca_cert=&amp;#8221;/home/username/bhamuni.pem&amp;#8221; phase2=&amp;#8221;auth=MSCHAPV2&amp;#8221; priority=2 auth_alg=OPEN }&lt;/p&gt;
      
      &lt;p&gt;Also remember to edit it with your correct username and password. This is the same as the your university one.&lt;/p&gt;
      
      &lt;p&gt;You should be able to test that this works by just running &amp;#8216;netcfg-auto-wireless wlan0&amp;#8217; (again subsitituting in your correct interface name for wlan0). It should then be connected.&lt;/p&gt;
      
      &lt;p&gt;To automate the process, add &amp;#8216;net-auto&amp;#8217; (without the quotes) to the DAEMONS line in /etc/rc.conf, and then make sure that the line &amp;#8216;AUTO_NETWORKS=(auto-wireless wlan0)&amp;#8217; is also somewhere in the file (mine is just above the DAEMONS line). This should then automatically connect if you boot up within range of the network.&lt;/p&gt;
    </content>
    <published>2008-10-27T00:00:00+00:00</published>
    <updated>2008-10-27T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='netcfg'></category>
  </entry>
</feed>

<!-- page cached: 2011-03-07 00:49:20 -->


