<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Muffin Research Labs</title>
	
	<link>http://muffinresearch.co.uk</link>
	<description>the personal blog of Stuart Colville covering modern web development techniques and best practices</description>
	<pubDate>Mon, 22 Jun 2009 22:17:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
			<geo:lat>51.1324</geo:lat><geo:long>0.2652</geo:long><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/muffinresearch" type="application/rss+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item>
		<title>BASH: Using brace expansion</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/Cr5w5QigONg/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/06/22/bash-using-brace-expansion/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 22:17:47 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=642</guid>
		<description>There&amp;#8217;s a nice feature of BASH which is to use a comma delimited list of strings inside of curly braces to reduce the amount of typing:
here&amp;#8217;s an example of using brace expansion to create log files for apache:
sudo touch {access,error}.log
Something seen less often is a blank entry like so:
cp foo{,.bck}
Which is shorthand for cp foo [...]</description>
			<content:encoded><![CDATA[<p>There&#8217;s a nice feature of BASH which is to use a comma delimited list of strings inside of curly braces to reduce the amount of typing:</p>
<p>here&#8217;s an example of using brace expansion to create log files for apache:</p>
<pre><code>sudo touch {access,error}.log</code></pre>
<p>Something seen less often is a blank entry like so:</p>
<pre><code>cp foo{,.bck}</code></pre>
<p>Which is shorthand for <code>cp foo foo.bck</code>. This is really useful when copying and moving files around using long paths. Using brace expansion can minimise the amount of typing and help avoid errors caused by typos too.</p>
<p>Another use of brace expansion since BASH v3.0 is the possibility of using ranges within the lists like so:</p>
<pre><code>for foo in {1..10}
> do
> echo $foo
> done
1
2
3
4
5
6
7
8
9
10</code></pre>
<p>Or alternatively with letters too:</p>
<pre><code>echo {a..f}
a b c d e f
</code></pre>
<p>See the <a href="http://tldp.org/LDP/abs/html/special-chars.html#BRACEEXPREF">advanced bash scripting guide</a> for more examples.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Cr5w5QigONg:HttqPeBnEvk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Cr5w5QigONg:HttqPeBnEvk:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Cr5w5QigONg:HttqPeBnEvk:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Cr5w5QigONg:HttqPeBnEvk:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/Cr5w5QigONg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/06/22/bash-using-brace-expansion/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/06/22/bash-using-brace-expansion/</feedburner:origLink></item>
		<item>
		<title>vim: automatically highlight long lines</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/Uqxgfzdueg4/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/06/22/vim-automatically-highlight-long-lines/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:50:24 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=633</guid>
		<description>This .vimrc snippet highlights lines when you exceed 77 columns - this is especially useful if you are trying to adhere to PEP8 with Python development. 
The if statement makes this work for older vims as well as more recent versions which is handy if you put your .vimrc on remote boxes as vim below [...]</description>
			<content:encoded><![CDATA[<p>This <code>.vimrc</code> snippet highlights lines when you exceed 77 columns - this is especially useful if you are trying to adhere to <a href="http://www.python.org/dev/peps/pep-0008/">PEP8</a> with Python development. </p>
<p>The <code>if</code> statement makes this work for older vims as well as more recent versions which is handy if you put your .vimrc on remote boxes as vim below v7.1.40 doesn&#8217;t have the <code>matchadd</code> function.</p>
<pre><code>" Highlight lines over 77 columns
if has('matchadd')
    :au BufWinEnter * let w:m1=matchadd('Search', '\%<81v.\%>77v', -1)
    :au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
else
    :au BufRead,BufNewFile * syntax match Search /\%<81v.\%>77v/
    :au BufRead,BufNewFile * syntax match ErrorMsg /\%>80v.\+/
endif</code></pre>
<p>To configure highlighting to work manually see the vim wiki for more details <a href="http://vim.wikia.com/wiki/Highlight_long_lines">http://vim.wikia.com/wiki/Highlight_long_lines</a></p>
<p>Whilst I&#8217;ve often heard people snub the PEP8  recommendation for keeping line length to under 79 chars,  I&#8217;ve personally found it leads to more readable code whether you live in a terminal or use gui editors. <acronym title="Your Mileage May Vary">YMMV</acronym></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Uqxgfzdueg4:oN0CpoKodjQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Uqxgfzdueg4:oN0CpoKodjQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Uqxgfzdueg4:oN0CpoKodjQ:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Uqxgfzdueg4:oN0CpoKodjQ:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/Uqxgfzdueg4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/06/22/vim-automatically-highlight-long-lines/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/06/22/vim-automatically-highlight-long-lines/</feedburner:origLink></item>
		<item>
		<title>Bash: turn on case-insensitive tab completion</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/WoSALbMHxKI/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/06/06/bash-turn-on-case-insensitive-tab-completion/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 10:24:40 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=626</guid>
		<description>I always forget this one, but it&amp;#8217;s dead handy as it allows you to type &amp;#8220;py&amp;#8221; hit tab and it will auto complete for &amp;#8220;Python&amp;#8221; or &amp;#8220;python&amp;#8221; for example. Without this setting you&amp;#8217;d have to type explicitly what you want. To enable run:
echo set completion-ignore-case on &amp;#124; sudo tee -a /etc/inputrc
tee -a appends to the [...]</description>
			<content:encoded><![CDATA[<p>I always forget this one, but it&#8217;s dead handy as it allows you to type &#8220;py&#8221; hit tab and it will auto complete for &#8220;Python&#8221; or &#8220;python&#8221; for example. Without this setting you&#8217;d have to type explicitly what you want. To enable run:</p>
<pre><code>echo set completion-ignore-case on | sudo tee -a /etc/inputrc</code></pre>
<p><code>tee -a</code> appends to the file - though clearly proceed with caution and if in any doubt backup /etc/inputrc first.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=WoSALbMHxKI:JCkvLYcEL-Q:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=WoSALbMHxKI:JCkvLYcEL-Q:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=WoSALbMHxKI:JCkvLYcEL-Q:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=WoSALbMHxKI:JCkvLYcEL-Q:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/WoSALbMHxKI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/06/06/bash-turn-on-case-insensitive-tab-completion/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/06/06/bash-turn-on-case-insensitive-tab-completion/</feedburner:origLink></item>
		<item>
		<title>Running VMware images under VirtualBox</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/2HO5hZhb9K4/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/06/04/running-vmware-images-under-virtualbox/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 12:11:23 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Linux/Unix]]></category>

		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=619</guid>
		<description>I use the excellent VirtualBox on Ubuntu but I had a specific Debian dev environment VM that I&amp;#8217;d previously run under VMware Fusion on my work mac when it used to have OSX on it ;-). The current versions of VirtualBox (2.2.4 in my case) support running vmdk disks now so it makes it possible [...]</description>
			<content:encoded><![CDATA[<p>I use the excellent VirtualBox on Ubuntu but I had a specific Debian dev environment <acronym title="Virtual Machine">VM</acronym> that I&#8217;d previously run under VMware Fusion on my work mac when it used to have OSX on it ;-). The current versions of VirtualBox (2.2.4 in my case) support running vmdk disks now so it makes it possible to just create a new vm with the appropriate setting for the existing vm image and attach the disks, or so I thought!</p>
<p>When I first ran the image it looked to book up fine - however when it got to mounting the root file system it hung saying &#8220;Waiting for root filesystem&#8221;</p>
<p>Fortunately whilst looking at the hard-disk settings (with the vm shutdown) I noticed that there were additional adapters for SATA and SCSI. Vmware by default uses SATA so getting it working was a simple as enabling the SATA adapter and setting each disk to the correct SATA ports 0 and 1 in my case as I have 2 hard disks. </p>
<p><img src="http://muffinresearch.co.uk/i/hard-disks.png" alt="hard disk dialogue" /></p>
<p>Booting the VM resulted in the filesystem mounting correctly and it all working!!! </p>
<p>I then thought it would be a plan to remove the VMware tools so I could install the VirtualBoxGuestAdditions. This turned out to be a bit of a nightmare as running the vmware-tools-uninstaller.pl also deleted my /etc/fstab (WTF?) so when I rebooted everything was read-only.</p>
<p>To get around this I booted back in single user mode and ran the following to remount the root filesystem as rw.</p>
<pre><code>mount -no remount,rw /</code></pre>
<p>Next I recreated the /etc/fstab from a backup and saved it.</p>
<p>Lastly I returned everything back to readonly with</p>
<pre><code>mount -no remount,ro /</code></pre>
<p>and then rebooted. After that it was a case of mounting the VirtualBoxGuestAdditions.iso mounting it at /media/cdrom and then running the installer from there.</p>
<p>Job&#8217;s a good&#8217;un. If you&#8217;re doing the same steps I&#8217;d strongly recommend backing-up or checking /etc/fstab is still there after removing vmware tools in case it get&#8217;s binned by the vmware tools script of LOL, so you don&#8217;t have to go through the same pain to get it all working.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=2HO5hZhb9K4:U1RRzIMhRpU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=2HO5hZhb9K4:U1RRzIMhRpU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=2HO5hZhb9K4:U1RRzIMhRpU:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=2HO5hZhb9K4:U1RRzIMhRpU:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/2HO5hZhb9K4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/06/04/running-vmware-images-under-virtualbox/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/06/04/running-vmware-images-under-virtualbox/</feedburner:origLink></item>
		<item>
		<title>Ubuntu: Turn off changing workspace with mouse wheel</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/oiwAmp_Pm20/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/06/02/ubuntu-turn-off-changing-workspace-with-mouse-wheel/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 09:21:30 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=616</guid>
		<description>I found the changing with the workspace with the mouse wheel really annoying. To disable it go to  System =&gt; Preferences =&gt; CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck &amp;#8220;Viewport Switcher&amp;#8221; which is under the &amp;#8220;Desktop&amp;#8221; heading.</description>
			<content:encoded><![CDATA[<p>I found the changing with the workspace with the mouse wheel really annoying. To disable it go to  System => Preferences => CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck &#8220;Viewport Switcher&#8221; which is under the &#8220;Desktop&#8221; heading.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=oiwAmp_Pm20:LjmmKO9MSMc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=oiwAmp_Pm20:LjmmKO9MSMc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=oiwAmp_Pm20:LjmmKO9MSMc:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=oiwAmp_Pm20:LjmmKO9MSMc:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/oiwAmp_Pm20" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/06/02/ubuntu-turn-off-changing-workspace-with-mouse-wheel/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/06/02/ubuntu-turn-off-changing-workspace-with-mouse-wheel/</feedburner:origLink></item>
		<item>
		<title>Simple Switching of VirtualEnv Environments</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/FXC5pIqh8yA/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/05/12/simple-switching-of-virtualenv-environments/#comments</comments>
		<pubDate>Tue, 12 May 2009 23:59:23 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=603</guid>
		<description>If you&amp;#8217;re using Python for any kind of serious development virtualenv is highly recommended as a way to sandbox dependencies and allow you to run different libraries and or python versions for different projects. For more on Virtualenv and how to use it see VirutalEnv on PyPi
I wanted a quick way to switch virtual environments [...]</description>
			<content:encoded><![CDATA[<p>If you&#8217;re using Python for any kind of serious development virtualenv is highly recommended as a way to sandbox dependencies and allow you to run different libraries and or python versions for different projects. For more on Virtualenv and how to use it see <a href="http://pypi.python.org/pypi/virtualenv">VirutalEnv on PyPi</a></p>
<p>I wanted a quick way to switch virtual environments from anywhere. The result is a simple bash function that lists your available environments (albeit the assumption is you install your virtual environments in one place.) so you can choose one and activate it from anywhere.</p>
<p>The function should be placed in your .bashrc. The reason that this is a function and not a shell-script is that functions are executed in the current shell whereas placing the <strong>same code in a shell-script won&#8217;t work</strong> as a shell script invokes a separate process. As the environment activation alters the environment it needs to be run in the current shell to work.</p>
<pre><code>function venvswitch {
VENV_DIR=~/pythonenv
cd $VENV_DIR
echo 'Choose Virtual Env:'

select dir in *;
do
    if [ -n "$dir" ] &#038;&#038; [ -f $dir/bin/activate ]
    then
      source $VENV_DIR/$dir/bin/activate
      break
    else
      echo "Error: You choice '$REPLY' does not correspond to a virtual env."
    fi
done
cd - > /dev/null
}</code></pre>
<p>Basicaly what the script does is tell you what envs you have and you just select a number to activate that environment. Sourcing the bin/activate in the chosen environment alters your path and also adds a deactivation function. </p>
<p>To run it (after you&#8217;ve sourced your .bashrc - <code>source ~/.bashrc</code>) simpy type:</p>
<p><code>venvswitch</code></p>
<p>De-activating the virtalenv is as simple as running the following (this feature is provided by virtualenv itself):</p>
<p><code>deactivate</code> </p>
<p>You will notice the prompt is returned to normal and your $PATH is reverted back to what it was prior to activation.</p>
<h3>Alternatives</h3>
<p>Here&#8217;s some alternative VirutalEnv wrappers to try out:</p>
<ul class="ext">
<li><a href="http://www.doughellmann.com/projects/virtualenvwrapper/">Doug Hellman&#8217;s VirtualEnv Wrapper</a></li>
<li><a href="http://justinlilly.com/blog/2009/mar/28/virtualenv-wrapper-helper/">Justin Lilly&#8217;s Auto VirtualEnv Helper</a></li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=FXC5pIqh8yA:4zeCixtsIJ4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=FXC5pIqh8yA:4zeCixtsIJ4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=FXC5pIqh8yA:4zeCixtsIJ4:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=FXC5pIqh8yA:4zeCixtsIJ4:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/FXC5pIqh8yA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/05/12/simple-switching-of-virtualenv-environments/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/05/12/simple-switching-of-virtualenv-environments/</feedburner:origLink></item>
		<item>
		<title>Vim: Setting the colorscheme Doesn’t Work</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/nVfRlIBmFkg/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/04/28/setting-the-colorscheme-doesnt-work-in-vim/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 21:29:08 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=581</guid>
		<description>If you&amp;#8217;ve found a fancy colorscheme for vim and you want to try it out, once you&amp;#8217;ve saved the colorscheme file to ~/.vim/colors you can enable the theme with the following in a vim session&amp;#8217;s command mode:
:colorscheme fruity
If you want the colorscheme to be permanent then you can set the name of the theme in [...]</description>
			<content:encoded><![CDATA[<p>If you&#8217;ve found a fancy colorscheme for vim and you want to try it out, once you&#8217;ve saved the colorscheme file to ~/.vim/colors you can enable the theme with the following in a vim session&#8217;s command mode:</p>
<pre><code>:colorscheme fruity</code></pre>
<p>If you want the colorscheme to be permanent then you can set the name of the theme in your ~/.vimrc file with:</p>
<pre><code>colorscheme fruity</code></pre>
<p>However if this doesn&#8217;t work then it&#8217;s probably that your terminal doesn&#8217;t support enough colors. Fixing the amount of colors the terminal can display is fairly easy by simply exporting the TERM environment variable to use the 256 color xterm. (<em>Sadly this is not possible on OSX&#8217;s leopard terminal as it only supports 16 colors though apparently iTerm does have 256 color support</em>)</p>
<pre><code>export TERM=xterm-256color</code></pre>
<p>An alternative to this is to start vim with the terminal switch set to xterm-256color e.g:</p>
<pre><code>vim -T xterm-256color</code></pre>
<p>Once this is done the colorschemes should work just fine.</p>
<h3>Simplying the colors used by gvim themes</h3>
<p>Another issue that you can hit is when trying to use a gvim (gui version) theme in vim it may specify colors that don&#8217;t fit within the range your terminal is capable of displaying. CSApprox is a plugin which converts the colors in gvim themes to the closest color that will work with your term see http://www.vim.org/scripts/script.php?script_id=2390 for more info.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=nVfRlIBmFkg:PB9s0iajQ48:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=nVfRlIBmFkg:PB9s0iajQ48:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=nVfRlIBmFkg:PB9s0iajQ48:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=nVfRlIBmFkg:PB9s0iajQ48:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/nVfRlIBmFkg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/04/28/setting-the-colorscheme-doesnt-work-in-vim/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/04/28/setting-the-colorscheme-doesnt-work-in-vim/</feedburner:origLink></item>
		<item>
		<title>VirtualBox: Access Guests via a Virtual Interface</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/IfaiQ2G2LHo/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/04/08/virtualbox-access-guests-via-a-virtual-interface/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 09:50:05 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=558</guid>
		<description>On Ubuntu I&amp;#8217;ve been using VirtualBox as the solution for cross-browser testing as well as a place for creating sandboxed Hardy VMs for testing Project Fondue infrastructure changes. For example I&amp;#8217;m currently testing out how to migrate from Trac to Redmine so VM&amp;#8217;s are the perfect way to carry out a dry-run of the installation [...]</description>
			<content:encoded><![CDATA[<p>On Ubuntu I&#8217;ve been using VirtualBox as the solution for cross-browser testing as well as a place for creating sandboxed Hardy VMs for testing Project Fondue infrastructure changes. For example I&#8217;m currently testing out how to migrate from Trac to Redmine so VM&#8217;s are the perfect way to carry out a dry-run of the installation and migration.</p>
<p>One of the difficulties I&#8217;d had was getting the networking of the Hardy VM set-up in a way that works so that I can access the outside world and access all services of the Guest OS. With NAT it&#8217;s possible to run various commands so you can forward ports from the host to the guest vm but this is a bit of annoyance if you have to set-up port-forwarding for every service you need to access on your VM. </p>
<p>I&#8217;d also tried Host networking but this didn&#8217;t really work out, I like to be able to access VMs when I&#8217;m not attached to a network so having a Host networking configuration that relies on setting-up the VMs as if they&#8217;re on the local network I&#8217;m attached to at the time doesn&#8217;t really cut it as soon as I&#8217;m trying to interact with a VM on the train for example.</p>
<p>With VMware fusion on OSX it was really easy to access the Guest from the host via the vmnet8 interface. Having had it easy I was looking for a similar solution for VirtualBox. Fortunately I found <a href="http://www.upfrontsystems.co.za/Members/izak/sysadman/local-access-to-a-virtualbox-instance">this post on using TAP interfaces to make connections to the Guest</a> very straightforward. The following is based on that post expanding on some of the steps with further code examples and explanations as necessary.</p>
<h3>Howto: Access SSH etc with virtual interface</h3>
<p class="update">Note: I&#8217;m using VirtualBox 2.1.4 PUEL edition.  With other versions <acronym title="Your Mileage May Vary">YMMV</acronym></p>
<p>First step is to install the ulm-utilities which make it possible to create virtual interfaces:</p>
<p><code>sudo apt-get install uml-utilities</code></p>
<p>Next on the host set-up a TAP interface in  /etc/network/interfaces  as follows:</p>
<pre><code>auto tap0
iface tap0 inet manual
    up ifconfig $IFACE 172.16.1.1 netmask 255.255.255.0 up
    down ifconfig $IFACE down
    tunctl_user &lt;user&gt;</code></pre>
<p>The tap interface <a href="http://vtun.sourceforge.net/tun/faq.html#1.2">is a virtual interface as explained here</a>.</p>
<p>Replacing &lt;user&gt; for your username. For the tap interface to work add yourself to the vboxusers groups: <code>sudo usermod -a -G vboxusers &lt;user&gt;</code></p>
<p>You can bring-up the tap0 interface by running: <code>sudo ifup tap0</code><br />
Running <code>ifconfig</code> on the host should show the tap0 interface.</p>
<p>In the settings for the Guest set-up the second interface to use host networking and select the tap0 interface:</p>
<p><img src="http://muffinresearch.co.uk/i/networking.png" alt="VirtualBox Networking Dialogue"/></p>
<p>Next boot-up the guest and test outbound networking by pinging google.co.uk. If that&#8217;s all good add a second interface to /etc/network/interfaces on the guest:</p>
<pre><code>auto eth1
iface eth1 inet static
    address 172.16.1.2
    netmask 255.255.255.0</code></pre>
<p>Restart the guest and you should be able to see the guest&#8217;s apache (assuming apache is installed) or ssh (you have installed openssh-server right?) in via 172.16.1.2. </p>
<p>NAT should should also still be working for outbound net access.</p>
<p>Now you have the tap0 interface on your host you can add more VMS and set them up accordingly with unique ip addresses and you can still access your VMs from your host when offline. Winner!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=IfaiQ2G2LHo:vMBC18epqHo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=IfaiQ2G2LHo:vMBC18epqHo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=IfaiQ2G2LHo:vMBC18epqHo:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=IfaiQ2G2LHo:vMBC18epqHo:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/IfaiQ2G2LHo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/04/08/virtualbox-access-guests-via-a-virtual-interface/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/04/08/virtualbox-access-guests-via-a-virtual-interface/</feedburner:origLink></item>
		<item>
		<title>From OSX to Ubuntu</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/ZdKnkOZG_1g/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/04/05/from-osx-to-ubuntu/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 23:34:15 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Apple]]></category>

		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=548</guid>
		<description>I&amp;#8217;ve recently switched to using Ubuntu full-time as my primary operating system having previously used Macs for the last 4+ years. Moving over to ubuntu has been easy enough, I bought a lenovo R61 which has extremely good compatibility with Ubuntu out of the box. I&amp;#8217;ve had very few issues except for an a smaill [...]</description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently switched to using Ubuntu full-time as my primary operating system having previously used Macs for the last 4+ years. Moving over to ubuntu has been easy enough, I bought a lenovo R61 which has extremely good compatibility with Ubuntu out of the box. I&#8217;ve had very few issues except for an a smaill problem with the <a href="https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/313231">brightness control</a> and an intermittant problem with X using 100% CPU when screensavers are activated. Though I&#8217;ve found simple enough workarounds for both issues.</p>
<p>I&#8217;m thinking about getting a US keyboard as this will be closer to the OSX keyboard thus making it less annoying for me to having to think where double-quotes and tilde are, as for now at least I&#8217;m probably going to continue using OSX at work until I can get to a good point to make it into the world&#8217;s most expensive ubuntu laptop.</p>
<h2>Software</h2>
<p>Here&#8217;s a few of the highlights of the software I&#8217;m using which has made the switch easier for me. </p>
<h3>Gnome-do</h3>
<p>Quicksilver was something I knew I&#8217;d miss but <a href="http://do.davebsd.com/">Gnome-do</a> seems to fill the hole quite nicely. It supports enough of the same featureset for me to be not feeling like I&#8217;m missing anything. To install it use the <a href="https://edge.launchpad.net/~do-core/+archive/ppa">PPA (Personal Package Archive)</a> so you can get the most up to date version.</p>
<h3>Drop-down terminal</h3>
<p><a href="http://yakuake.kde.org/">Yakuake</a> has filled the slot performed by Visor on OSX. Although it&#8217;s based on Konsole it took the edge over <a href="http://trac.guake-terminal.org/">Guake</a> as it&#8217;s slightly more configurable. </p>
<h3>Virtualization</h3>
<p><a href="http://www.virtualbox.org/">Virtualbox OSE</a> - is carrying out Virtualization duties - though I wish that it was easier to communicate with headless VMs I&#8217;m used to being able to SSH into VMs straight away having used VMware Fusion on OSX. Hopefully this is something that will be addressed in future versions or something I can resolve as I get more familiar with it&#8217;s networking configurations. The version of VirtualBox OSE in the upcoming Ubuntu release (Jaunty) is newer so I looking forward to trying that out. Update: I&#8217;ve fixed the issues with networking <a href="http://muffinresearch.co.uk/archives/2009/04/08/virtualbox-access-guests-via-a-virtual-interface/">using a virtual interface to access VirtualBox guests.<br />
</a></p>
<h3>Fonts</h3>
<p>I&#8217;m using <a href="http://fontmatrix.net/">font matrix</a> to manage my font collection which seems just as much of a font management app as I need.</p>
<p>Aside from managing fonts I found that installing the  ttf-liberation package (free alternatives to well known Microsoft fonts) made everything  look like the proverbial &#8220;kick in the nuts&#8221; so I&#8217;ve manually played with /etc/fonts/conf.d/30-metric-aliases.conf and added &#8220;Freesans&#8221; above &#8220;Liberation Sans&#8221; for use in place of Arial. This has made all web apps like gmail etc much nicer to use as FreeSans is just gorgeous to look at. </p>
<pre><code>&lt;!-- Microsoft --&gt;
&lt;alias binding="same"&gt;
    &lt;family&gt;Arial&lt;/family&gt;
    &lt;accept&gt;
    &lt;family&gt;Freesans&lt;/family&gt;
    &lt;family&gt;Liberation Sans&lt;/family&gt;
    &lt;family&gt;Albany&lt;/family&gt;
    &lt;!-- &lt;family&gt;Albany AMT&lt;/family&gt; --&gt;
    &lt;/accept&gt;
&lt;/alias&gt;</code></pre>
<p>In a similar fashion Georgia is horrific on Linux for some reason, whereas FreeSerif actually looks really good. At some point I&#8217;d love to do an up to date review of what fonts are best equivalents on various linux distros. One thing that&#8217;s clear with all the substitutions going on in the font configs it&#8217;s hard to really know what actual font you are really seeing rendered in a web page. I&#8217;d like to find a way to introspect that and really know what&#8217;s happening for linux.</p>
<h3>Code-editing</h3>
<p>I&#8217;m trying to get better at using vim as I work on other machines quite a lot via ssh; so improving my working knowledge of vim is definitely a good move for me. I&#8217;m also playing with gedit and it&#8217;s numerous plugins. Sure it&#8217;s not textmate but I&#8217;ve been able to emulate enough aspects of textmate that I like to make it useful. I&#8217;ve switched indentation to use alt+[ and  unindent alt+] but doing that meant I had to patch the <a href="http://www.garyharan.com/index.php/2006/11/16/gemini-gedit-plugin-for-all-those-textmate-fans/">gemini plugin</a> so that it didn&#8217;t try and match a square bracket when I was using the alt modifier (I&#8217;ll post the source to that if it&#8217;s of any use to anyone). That was easy enough though thanks plugins being python and I could work out what I needed to do purely using introspection and some educated guesses. That&#8217;s one thing I really like about gedit. All that&#8217;s needed is some improvements to make snippets and commands scoped to specific languages together in one interface. Other things like code folding are about to land in the gtksourceview  component too so over time it will be interesting to see where it goes.</p>
<p>Lastly I miss the bookmarking ability that textmate has. In textmate clicking the gutter containing the line-number is all you need to create a bookmark. It&#8217;s nicely done and a preferable approach the way the gedit bookmark plugin works. This would presumbably something that would be implemented in the gtksourceview rather than as a plugin if the interface was to be identical.</p>
<h3>Backup</h3>
<p>For backup I&#8217;m currently trying Bubakup which can create backups of a live system which are bootable. Something of a simplistic SuperDuper for Linux. It&#8217;s very easy to use - and I&#8217;ve not checked yet but I&#8217;m hoping that it&#8217;s something I&#8217;ll be able to set-up on cron.</p>
<h3>Graphics Apps</h3>
<p>I&#8217;m adjusting to learning GIMP as a long time photoshop user. I&#8217;m pretty sure in time I&#8217;ll be able to find out how to do everything I could do on Photoshop with it, it seems very powerful. For vector I&#8217;ll be using Inkscape which again is pretty competent and I&#8217;ve already been using it on the mac to edit some of the Project Fondue mountain headers.</p>
<h2>So what&#8217;s missing?</h2>
<p>Application-wise - I&#8217;d like to find an equivalent to two apps. One is Omnifocus a Gtd application on OSX. The other is Together which is a general file/note-taking app which had the great feature of allowing you to add web addresses to it from which it created webarchives for viewing offline. These two apps are the only two things I&#8217;ve not got covered yet. I&#8217;m almost considering getting into Python GUI programming if I thought it wouldn&#8217;t suck up too much of my time. If you&#8217;ve got any suggestions for apps that would fill this role then please do let me know. With the note-taking thing I&#8217;d love to have something along the lines of a personal wiki which can handle ReStructuredText and can create archives of web-pages - though that may just be something I&#8217;ll build as a web app. Key thing here would be either you run it locally or it must have offline access.</p>
<p>So far I&#8217;m not really missing that much - clearly OSX has a certain feel of slickness to it but in the last couple of years Ubuntu has become much more refined and easier to use. More an more works without intervention - I&#8217;d long held an opinion that using linux was like owning a vintage beetle &#8212; It&#8217;s great but you have to spend all weekend tinkering with it to keep it on the road. For me using windows  <em>was</em> like that, as I found more and more time was sucked into keeping my PC running. When I switched to OSX I found my productivity went up. So far with Linux it&#8217;s too early to tell whether I&#8217;m as productive though I&#8217;m fairly confident that I&#8217;m finding enough software that performs well and is intuitive to use that I should be every bit as &#8220;at home&#8221; on Linux as I was on the mac. Plus with the added bonus that I&#8217;ve got a much better set of linux tools (rather than bsd) under the hood and not to mention that running an open source operating system is a much better prospect long term.</p>
<p>By all means any thoughts and recommendations towards must-have software etc - please drop a comment.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=ZdKnkOZG_1g:qn49Rh9Ekro:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=ZdKnkOZG_1g:qn49Rh9Ekro:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=ZdKnkOZG_1g:qn49Rh9Ekro:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=ZdKnkOZG_1g:qn49Rh9Ekro:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/ZdKnkOZG_1g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/04/05/from-osx-to-ubuntu/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/04/05/from-osx-to-ubuntu/</feedburner:origLink></item>
		<item>
		<title>Ubuntu: Mounting a TrueCrypt volume at startup or from the CLI</title>
		<link>http://feedproxy.google.com/~r/muffinresearch/~3/Pl1hHex3drU/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/04/05/ubuntu-mounting-a-truecrypt-volume-at-startup-or-from-the-cli/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 16:07:48 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
		
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=545</guid>
		<description>All you need is a mount point e.g: mkdir /media/ and then use the following: truecrypt /path/to/truecrypt/diskimage /media/. This is handy when you want to mount a truecrypt image at start-up or just do it quickly from a shell. It&amp;#8217;s far more direct than using the GUI.</description>
			<content:encoded><![CDATA[<p>All you need is a mount point e.g: <code>mkdir /media/<mountpoint></code> and then use the following: <code>truecrypt /path/to/truecrypt/diskimage /media/<mountpoint></code>. This is handy when you want to mount a truecrypt image at start-up or just do it quickly from a shell. It&#8217;s far more direct than using the GUI.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Pl1hHex3drU:4WBFUmmEppQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Pl1hHex3drU:4WBFUmmEppQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Pl1hHex3drU:4WBFUmmEppQ:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2mJPEYqXBVI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/muffinresearch?a=Pl1hHex3drU:4WBFUmmEppQ:2nqncYFp4_M"><img src="http://feeds.feedburner.com/~ff/muffinresearch?d=2nqncYFp4_M" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/muffinresearch/~4/Pl1hHex3drU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/04/05/ubuntu-mounting-a-truecrypt-volume-at-startup-or-from-the-cli/feed/</wfw:commentRss>
		<feedburner:origLink>http://muffinresearch.co.uk/archives/2009/04/05/ubuntu-mounting-a-truecrypt-volume-at-startup-or-from-the-cli/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 0.424 seconds --><!-- Cached page served by WP-Cache -->
