<?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>2012-04-04T00:00:00+00:00</updated>
  <author>
    <name>Peter Lewis</name>
    <uri>http://www.muddygoat.org</uri>
    <email>pete@muddygoat.org</email>
  </author>
  <entry>
    <title>Prettifying command output in scripts.</title>
    <link href='http://www.muddygoat.org/articles/indenting-output' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2012-04-04:/articles/indenting-output</id>
    <content type='html'>
      &lt;p&gt;This is so simple but so nice, that I had to share. Often, I want to create a
      small script which gives me some information, using another program, and I want
      to display it in some way which looks nice.&lt;/p&gt;
      
      &lt;p&gt;For example:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;% tmux ls&amp;#x000A;dev: 1 windows (created Wed Apr  4 14:54:56 2012) [116x34] (attached)&amp;#x000A;main: 5 windows (created Wed Apr  4 14:31:07 2012) [116x34] (attached)&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Can be wrapped up in a prettifying script, like so:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;echo &quot;Running tmux sessions:&quot;&amp;#x000A;tmux ls&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Which gives us:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Running tmux sessions:&amp;#x000A;dev: 1 windows (created Wed Apr  4 14:54:56 2012) [116x34] (attached)&amp;#x000A;main: 5 windows (created Wed Apr  4 14:31:07 2012) [116x34] (attached)&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;But this doesn't look too nice, and if there's a lot of output from different
      things, might just become one big block of text.&lt;/p&gt;
      
      &lt;p&gt;Never fear! With sed and pipes to the rescue, we can prettify things further.
      Indentation is one example of this, by replacing the start of each line output
      by 'tmux ls' with some whitespace. Our script might become:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;echo &quot;Running tmux sessions:&quot;&amp;#x000A;tmux ls | sed &quot;s/^/    /&quot;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Which would give us:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Running tmux sessions:&amp;#x000A;    dev: 1 windows (created Wed Apr  4 14:54:56 2012) [116x34] (attached)&amp;#x000A;    main: 5 windows (created Wed Apr  4 14:31:07 2012) [116x34] (attached)&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Or even nicer:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;echo &quot;Running tmux sessions:&quot;&amp;#x000A;tmux ls | sed &quot;s/^/--&amp;gt; /&quot;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Which would give us:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Running tmux sessions:&amp;#x000A;--&amp;gt; dev: 1 windows (created Wed Apr  4 14:54:56 2012) [116x34] (attached)&amp;#x000A;--&amp;gt; main: 5 windows (created Wed Apr  4 14:31:07 2012) [116x34] (attached)&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Nice, and very very simple.&lt;/p&gt;
    </content>
    <published>2012-04-04T00:00:00+00:00</published>
    <updated>2012-04-04T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='shell'></category>
  </entry>
  <entry>
    <title>Keeping git submodules up to date.</title>
    <link href='http://www.muddygoat.org/articles/git-submodules' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-12-04:/articles/git-submodules</id>
    <content type='html'>
      &lt;p&gt;Like many others, I keep my dotfiles in a git repository, to easily track them,
      back them up and share them across machines. This includes &lt;a href=&quot;http://muddygoat.org/git/vim.git/&quot;&gt;my Vim
      configuration&lt;/a&gt; and add-on scripts. Even better, I use the excellent
      &lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=2332&quot;&gt;pathogen script&lt;/a&gt; to keep each external script in a separate git
      submodule. If you're not familiar with this idea, I'd suggest watching Drew
      Neil's excellent &lt;a href=&quot;http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/&quot;&gt;VimCast&lt;/a&gt; on how to get it set up.&lt;/p&gt;
      
      &lt;p&gt;I won't repeat any of that here, but what I do always seem to forget is how to
      update the submodules to the latest version. Remembering that git submodules are
      always kept in detached head state, i.e. not on any branch (which makes perfect
      sense from a software reliability point of view), we need to get back on the
      master branch before we pull in the latest changes:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ git submodule foreach git checkout master&amp;#x000A;$ git submodule foreach git pull&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Then, when you're happy that everything still works:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ git commit -a -m &quot;update submodules&quot;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;That's it!&lt;/p&gt;
    </content>
    <published>2011-12-04T00:00:00+00:00</published>
    <updated>2011-12-04T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='git'></category>
    <category term='vim'></category>
  </entry>
  <entry>
    <title>How to enable support for multi-lun USB devices.</title>
    <link href='http://www.muddygoat.org/articles/multi-lun' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-10-27:/articles/multi-lun</id>
    <content type='html'>
      &lt;p&gt;Damn, here was a problem. My shiny new USB smart card reader and integrated
      memory stick wouldn't quite work properly in Arch. The smart card reader was
      fine, but the mass storage device wasn't showing up. It seemed that the device
      had multiple LUNs (logical units), and the default Arch kernel wasn't configured
      to see these. No bother, we can add this to /etc/modprobe.d/modprobe.conf:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;options scsi_mod max_luns=4&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Then be sure to rebuild your initial RAM disk:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;# mkinitcpio -p linux&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;And upon a reboot, the USB mass storage device is found!&lt;/p&gt;
      
      &lt;p&gt;(I have no idea why this functionality isn't enabled by default; perhaps there's
      some other problem that this can cause?)&lt;/p&gt;
      
      &lt;p&gt;Thanks to &lt;a href=&quot;http://ask.adaptec.com/scripts/adaptec_tic.cfg/php.exe/enduser/std_adp.php?p_faqid=4543&quot;&gt;this article&lt;/a&gt; on the Adaptec knowledge base for providing the
      know how.&lt;/p&gt;
    </content>
    <published>2011-10-27T00:00:00+00:00</published>
    <updated>2011-10-27T00:00:00+00:00</updated>
    <category term='articles'></category>
  </entry>
  <entry>
    <title>Sending desktop notifications from cron jobs.</title>
    <link href='http://www.muddygoat.org/articles/notify-from-cron' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-08-12:/articles/notify-from-cron</id>
    <content type='html'>
      &lt;p&gt;I often use the notify-send command to create pop-up notifications on my desktop
      when things happen (usually when a time consuming job completes). Here's an
      example:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;% do_stuff &amp;amp;&amp;amp; notify-send &quot;Done&quot;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;I started sticking lines like this in some cron jobs too, but for some reason it
      wasn't working. Then I discovered via &lt;a href=&quot;http://www.commandlinefu.com/commands/view/6167/i-finally-found-out-how-to-use-notify-send-with-at-or-cron&quot;&gt;this snippet&lt;/a&gt; on &lt;a href=&quot;http://www.commandlinefu.com/&quot;&gt;Command Line
      Fu&lt;/a&gt; that it's because cron doesn't run as a sub process of the desktop -
      hence it's not aware of your X session. This can be fixed, with a simple:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;export DISPLAY=:0&amp;#x000A;export XAUTHORITY=~/.Xauthority&amp;#x000A;do_stuff &amp;amp;&amp;amp; notify-send &quot;done&quot;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Nice!&lt;/p&gt;
    </content>
    <published>2011-08-12T00:00:00+00:00</published>
    <updated>2011-08-12T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='freedesktop'></category>
  </entry>
  <entry>
    <title>Inconsolata and boldface.</title>
    <link href='http://www.muddygoat.org/articles/inconsolata-xl' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-07-17:/articles/inconsolata-xl</id>
    <content type='html'>
      &lt;p&gt;&lt;a href=&quot;http://www.levien.com/type/myfonts/inconsolata.html&quot;&gt;Inconsolata&lt;/a&gt; has recently become my typeface of choice for
      monospaced environments (e.g. Vim, mutt, the terminal), where to be honest I
      spend the vast majority of my computing time.&lt;/p&gt;
      
      &lt;p&gt;It's an exceptionally readable and legible typeface, with all those nice
      features you'd want in a coding font, such as slashed zeros and obvious
      differences between punctuation marks. Here's it in action in gVim:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/inconsolata-in-vim.jpeg&quot; alt=&quot;Inconsolata in Vim.&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;Notice the bold font that's used to indicate the article's title. This is in
      fact not due to Inconsolata itself, since it only comes with a medium weighted
      font, not a boldfaced one. Instead, gVim does some clever stuff that bolds out
      the medium weighted font. Other programs seem able to do this too, urxvt for
      example. However, not all get it right. Here's a shot of konsole's attempt:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/inconsolata.jpeg&quot; alt=&quot;Inconsolata in Konsole.&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;Luckily, Sven Schwyn has created a variant of Inconsolata, called Inconsolata
      XL, which includes a bold weighted font. It's available &lt;a href=&quot;http://www.bitcetera.com/en/techblog/2009/10/09/inconsolata-xl-font/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;Here's konsole using Inconsolata XL:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/inconsolata-xl.jpeg&quot; alt=&quot;Inconsolata-XL in Konsole.&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;Nice!&lt;/p&gt;
    </content>
    <published>2011-07-17T00:00:00+00:00</published>
    <updated>2011-07-17T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='kde'></category>
    <category term='type'></category>
    <category term='vim'></category>
  </entry>
  <entry>
    <title>Building ruby 1.8.7 with glibc 2.14</title>
    <link href='http://www.muddygoat.org/articles/ruby-18-glibc-214' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-07-15:/articles/ruby-18-glibc-214</id>
    <content type='html'>
      &lt;p&gt;It seems that there's a bug which means that ruby 1.8.7 and ruby enterprise
      edition 1.8.7 don't build with glibc 2.14:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I./src  -I./src   -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -Wall -Wwrit&amp;#x000A;e-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-c&amp;#x000A;free -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc  -DNO_FRAME_POINTER -g -O2 -c -o libtcmalloc_m&amp;#x000A;inimal_la-tcmalloc.lo `test -f 'src/tcmalloc.cc' || echo './'`src/tcmalloc.cc&amp;#x000A;libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virt&amp;#x000A;ual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign &amp;#x000A;-fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -DNO_FRAME_POINTER -g -O2 -c src/tcmalloc.cc  -fPIC -DPIC -o .libs/libtcm&amp;#x000A;alloc_minimal_la-tcmalloc.o&amp;#x000A;src/tcmalloc.cc:1672:54: error: conflicting declaration ‘void* (* __memalign_hook)(size_t, size_t, const void*)’&amp;#x000A;/usr/include/malloc.h:183:39: error: ‘__memalign_hook’ has a previous declaration as ‘void* (* volatile __memalign_hook)(size_t, size_t, const&amp;#x000A; void*)’&amp;#x000A;make: *** [libtcmalloc_minimal_la-tcmalloc.lo] Error 1&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;While those that understand this sort of thing sort it out, there's a workaround
      &lt;a href=&quot;https://gist.github.com/1057203&quot;&gt;posted on github&lt;/a&gt;. Here are the instructions (for ree):&lt;/p&gt;
      
      &lt;ol&gt;
      &lt;li&gt;Run &lt;code&gt;rvm install ree-1.8.7&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;Wait for it to fail.&lt;/li&gt;
      &lt;li&gt;&lt;p&gt;Fix the broken files with:&lt;/p&gt;
      
      &lt;p&gt; % cd ~/.rvm/src/ree-1.8.7-2011.03/source/ext/dl&lt;/p&gt;
      
      &lt;p&gt; % rm callback.func&lt;/p&gt;
      
      &lt;p&gt; % touch callback.func&lt;/p&gt;
      
      &lt;p&gt; % ruby mkcallback.rb &gt;&gt; callback.func&lt;/p&gt;
      
      &lt;p&gt; % rm cbtable.func&lt;/p&gt;
      
      &lt;p&gt; % touch cbtable.func&lt;/p&gt;
      
      &lt;p&gt; % ruby mkcbtable.rb &gt;&gt; cbtable.func&lt;/p&gt;&lt;/li&gt;
      &lt;li&gt;&lt;p&gt;Re-run &lt;code&gt;rvm install ree&lt;/code&gt; and the ruby files will not be re-extracted, so your changes to &lt;code&gt;callback.func&lt;/code&gt; and &lt;code&gt;cbtable.func&lt;/code&gt; will persist.&lt;/p&gt;&lt;/li&gt;
      &lt;/ol&gt;
    </content>
    <published>2011-07-15T00:00:00+00:00</published>
    <updated>2011-07-15T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='ruby'></category>
  </entry>
  <entry>
    <title>Theming the clock in KDE.</title>
    <link href='http://www.muddygoat.org/articles/kde-adjustable-clock' rel='alternate' type='text/html' />
    <id>tag:www.muddygoat.org,2011-07-13:/articles/kde-adjustable-clock</id>
    <content type='html'>
      &lt;p&gt;The default digital clock plasmoid (that's KDE's fancy term for a desktop
      widget, by the way) in KDE 4 so far has not been particularly configurable. You
      can change the font it uses, but not the font size, nor specify in much detail
      how the date is displayed. For example, after a bit of fiddling around, I'd
      managed to make some progress, but it seems to &quot;guess&quot; a lot of things, and get
      them wrong sometimes.  I got it looking like this:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/kde-default-clock.jpeg&quot; alt=&quot;KDE's default clock plasmoid, after a bit of tweaking.&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;It has clearly not guessed the right font sizes.&lt;/p&gt;
      
      &lt;p&gt;But, never fear, since there are a number of alternative clock plasmoids. One
      particularly configurable one is &lt;a href=&quot;http://kde-look.org/content/show.php/Adjustable+Clock?content=92825]&quot;&gt;adjustable clock&lt;/a&gt;. For some
      reason, the built-in &quot;get new plasmoids&quot; thing couldn't find this for me, but
      there's an Archlinux &lt;a href=&quot;http://aur.archlinux.org/packages.php?ID=21591&quot;&gt;PKGBUILD&lt;/a&gt; in the AUR.&lt;/p&gt;
      
      &lt;p&gt;On the face of it (no pun intended) this looks basically the same, but due to
      Plasma's great styling and scripting engines, you can specify any layout you
      like using HTML and CSS.&lt;/p&gt;
      
      &lt;p&gt;I wrote this snippet:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;&amp;lt;div style=&quot;text-align:center; white-space: nowrap; opacity:0.85; background:none; padding: 12px 0 0px 0;&quot;&amp;gt;&amp;#x000A;    &amp;lt;span style=&quot;font-size: 52px; font-family:'Gill Sans MT Pro'; text-shadow: black 0.1em 0.1em 0.2em&quot;&amp;gt;&amp;#x000A;        &amp;lt;span style=&quot;color: rgb(255, 255, 255);&quot;&amp;gt;&amp;lt;b&amp;gt;%!t&amp;lt;/b&amp;gt;&amp;lt;/span&amp;gt;&amp;#x000A;        &amp;lt;span style=&quot;color: rgb(200, 200, 200);&quot;&amp;gt; %T&amp;lt;/span&amp;gt;&amp;#x000A;    &amp;lt;/span&amp;gt;&amp;#x000A;&amp;lt;/div&amp;gt;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;This is fairly self-explanatory, I guess, but %!t provides the time sans
      seconds, while %T provides the long date. The full range of options are
      available from inside the adjustable clock's settings panel.&lt;/p&gt;
      
      &lt;p&gt;Here it is what it looks like:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/kde-adjustable-clock.jpeg&quot; alt=&quot;KDE's adjustable clock plasmoid, with the above HTML.&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;Now, there's still a quite annoying algorithm for scaling the widget, meaning
      that it's the ratios between font sizes and padding etc., that you have to get
      right, but a bit of fiddling and it's okay.&lt;/p&gt;
      
      &lt;p&gt;Let's hope KDE continues to remain as configurable as it has been known for!&lt;/p&gt;
    </content>
    <published>2011-07-13T00:00:00+00:00</published>
    <updated>2011-07-13T00:00:00+00:00</updated>
    <category term='articles'></category>
    <category term='kde'></category>
  </entry>
  <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've had a real annoyance with console Vim for a while now, which I just haven't
      been able to figure out. Today I did.&lt;/p&gt;
      
      &lt;p&gt;When you'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't, then Vim instead inserted some sort of symbol like&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;ä&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;instead of doing&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Esc d d&amp;#x000A;&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'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't happen there. But today I found that it
      wasn't happening outside of tmux at all. So, must be tmux'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&amp;#x000A;&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'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's code,
      which was arranged neatly into projects, packages etc., each of which built to a
      separate .jar file in its own subdirectory... ugh. (In case you haven't realised
      yet, I don'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 '*.jar' | tr '[:space:]' ':' | sed -e 's/:$//g' &amp;gt; classpath&amp;#x000A;&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 &quot;classpath&quot;.&lt;/p&gt;
      
      &lt;p&gt;Second, run the program like this, using the newly generated &quot;classpath&quot; file to
      tell the virtual machine where to look:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;java -cp `cat classpath` example.Main&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Thanks to &lt;a href=&quot;http://cefn.com&quot;&gt;Cefn Hoile&lt;/a&gt; for &lt;a href=&quot;http://cefn.com/blog/autojar.html&quot;&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'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'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't want to allow other things to start messing with what'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=&quot;http://aur.archlinux.org/&quot;&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=&quot;http://www.rubygems.org/&quot;&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=&quot;https://bbs.archlinux.org/viewtopic.php?id=113123&quot;&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...&amp;#x000A;&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&amp;#x000A;&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>
</feed>

<!-- page cached: 2013-09-02 09:32:24 -->

