<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>2tap.com &#187; Ubuntu</title>
	<atom:link href="http://2tap.com/category/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://2tap.com</link>
	<description>Random projects and stuff by Russ Hall in London</description>
	<lastBuildDate>Sun, 28 Feb 2010 18:08:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Throttling uploads on Linux</title>
		<link>http://2tap.com/2009/06/16/throttling-uploads-on-linux/</link>
		<comments>http://2tap.com/2009/06/16/throttling-uploads-on-linux/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 22:41:00 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://2tap.com/?p=137</guid>
		<description><![CDATA[I have recently been developing some fancy AJAX upload progress meters for a project I&#8217;m working on. This is using the new(ish) hooks in PHP which, when coupled with an extension such as APC, allow for polling of the upload progress as a file uploads in a standard HTML form. Developing on a local server, [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently been developing some fancy AJAX upload progress meters for a project I&#8217;m working on. This is using the new(ish) hooks in PHP which, when coupled with an extension such as APC, allow for polling of the upload progress as a file uploads in a standard HTML form.</p>
<p>Developing on a local server, however, means that file uploads are near instantaneous which makes testing&#8230; problematic. How best to simulate a real user&#8217;s experience?</p>
<p>My first instinct was to see if there were any suitable modules for Apache to enable bandwidth throttling. Apache 1.3 has mod_throttle which seems to be up to the task but I&#8217;m using Apache 2 and I don&#8217;t believe mod_throttle has been ported yet.</p>
<p>There also seem to be some extensions for Firefox which enable bandwidth limiting but these, unfortunately, are written for Windows environments.</p>
<p>The solution? <a href="http://www.monkey.org/~marius/trickle/">trickle</a>. Trickle is a portable lightweight userspace bandwidth shaper. It allows bandwidth limiting on a per-program basis and can be simply called with the executable as one of its parameters. Even better, it&#8217;s available in the Ubuntu repositories:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> trickle</pre></div></div>

<p>So, to restrict Firefox&#8217;s upload bandwidth we can run the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">trickle <span style="color: #660033;">-s</span> <span style="color: #660033;">-d</span> <span style="color: #000000;">1000</span> <span style="color: #660033;">-u</span> <span style="color: #000000;">10</span> firefox</pre></div></div>

<p>This limits the upload rate of Firefox to 10Kb/s. Perfect for testing form uploads.</p>
<p><strong>Note:</strong> The <strong>-d</strong> flag shouldn&#8217;t be necessary (according to the docs) but without this arbitrarily high setting, download bandwidth seems to be hampered. The <strong>-s</strong> flag merely instructs trickle to run in standalone mode (as opposed to running through the trickle daemon).</p>
]]></content:encoded>
			<wfw:commentRss>http://2tap.com/2009/06/16/throttling-uploads-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tap Trap &#8211; The year of procrastination</title>
		<link>http://2tap.com/2008/12/10/tap-trap-the-year-of-procrastination/</link>
		<comments>http://2tap.com/2008/12/10/tap-trap-the-year-of-procrastination/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 22:54:29 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tap Trap]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Uncategorised]]></category>

		<guid isPermaLink="false">http://2tap.com/?p=16</guid>
		<description><![CDATA[Since launching Tap Trap, there have been a steady stream of players stumbling across the game and, in some cases, getting hooked! I wrote the game a couple of years ago now (mostly as an experiment with JavaScript) and didn&#8217;t really plan to promote it particularly but it&#8217;s great to see around 15 new players [...]]]></description>
			<content:encoded><![CDATA[<p>Since launching <a title="Tap Trap" href="http://2tap.com/taptrap">Tap Trap</a>, there have been a steady stream of players stumbling across the game and, in some cases, getting hooked!</p>
<p>I wrote the game a couple of years ago now (mostly as an experiment with JavaScript) and didn&#8217;t really plan to promote it particularly but it&#8217;s great to see around 15 new players a day having a go!</p>
<p>It recently passed the 500,000th game played &#8211; around half of those games were actually completed (a score was submitted). From a quick scribble on the back of a Topman receipt (taking a rough average of 2 minutes per game) this means there&#8217;s been about 1 man year of <span style="text-decoration: line-through;">procrastination</span> play so far.</p>
<p>Well done to <span class="page-text"><em>Joe Bloggs 6140 </em>for the current high score of 5,510<em>. </em></span>The average score is <span class="page-text">1981.98 across all the games completed.</span></p>
<p><span class="page-text">The booby prize goes to </span><span class="page-text"><em>Joe Bloggs 2681 </em>for achieving the lowest score of just 152. It&#8217;s actually quite a feat to achieve such an abysmal score &#8211; seriously, try it. It&#8217;s not as easy as it looks!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://2tap.com/2008/12/10/tap-trap-the-year-of-procrastination/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu on the Asus Eeepc 901/1000/1000h</title>
		<link>http://2tap.com/2008/08/12/ubuntu-on-the-asus-eeepc-90110001000h/</link>
		<comments>http://2tap.com/2008/08/12/ubuntu-on-the-asus-eeepc-90110001000h/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 23:05:14 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[eeepc]]></category>

		<guid isPermaLink="false">http://2tap.com/?p=14</guid>
		<description><![CDATA[Useful custom kernel (including working wireless drivers) available from &#8220;adamm&#8221;&#8216;s repository here: http://www.array.org/ubuntu/ At the time of writing not everything&#8217;s fully worked out (issues with the headphone socket etc.) but it&#8217;s a good way to get the stock Hardy 8.04 install functional and on the net. For the most basic install (to get wireless working [...]]]></description>
			<content:encoded><![CDATA[<p>Useful custom kernel (including working wireless drivers) available from &#8220;adamm&#8221;&#8216;s repository here: <a href="http://www.array.org/ubuntu/">http://www.array.org/ubuntu/</a></p>
<p>At the time of writing not <em>everything&#8217;s </em>fully worked out (issues with the headphone socket etc.) but it&#8217;s a good way to get the stock Hardy 8.04 install functional and on the net.</p>
<p>For the most basic install (to get wireless working at least) you can just <a href="http://www.array.org/ubuntu/setup901.html">copy a couple of debs</a> onto a usb stick and &#8220;dpkg -i *&#8221; install them before getting the rest of the updates via the net repository.</p>
<p>Up to date discussion of progress currently available in <a href="http://forum.eeeuser.com/viewtopic.php?id=32303">this thread</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://2tap.com/2008/08/12/ubuntu-on-the-asus-eeepc-90110001000h/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing files between a Windows guest and Ubuntu host using VMware and Samba</title>
		<link>http://2tap.com/2007/04/22/sharing-files-between-a-windows-guest-and-ubuntu-host-using-vmware-and-samba/</link>
		<comments>http://2tap.com/2007/04/22/sharing-files-between-a-windows-guest-and-ubuntu-host-using-vmware-and-samba/#comments</comments>
		<pubDate>Sun, 22 Apr 2007 06:31:15 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://2tap.com/2007/04/22/sharing-files-between-a-windows-guest-and-ubuntu-host-using-vmware-and-samba/</guid>
		<description><![CDATA[VMware Workstation (and presumably the other enterprise-grade products in the VMware family) come with the handy &#8220;shared folders&#8221; feature which makes sharing files between a host and a virtual appliance nice and simple. The free products (VMware Player and Server) do not, unfortunately, have this ability and so we must find another way. This quick [...]]]></description>
			<content:encoded><![CDATA[<p>VMware Workstation (and presumably the other enterprise-grade products in the VMware family) come with the handy &#8220;shared folders&#8221; feature which makes sharing files between a host and a virtual appliance nice and simple. The free products (VMware Player and Server) do not, unfortunately, have this ability and so we must find another way.</p>
<p>This quick guide shows how to use <a href="http://www.samba.org" title="Samba">Samba</a> to achieve the same aim. It is aimed at Ubuntu users but (the general concepts at least) should work on any modern Linux distribution. It is also written with a Windows XP guest in mind but a similar process should work in Windows Vista, Windows 2000 and other operating systems.</p>
<p>The goal is to set up a network share which both operating systems can transparently read and write to.</p>
<p>For reference, I am using Ubuntu 7.04 (Feisty).</p>
<h3>Which VMware?</h3>
<p>I&#8217;ll presume you have VMWare already installed with a Windows XP guest virtual appliance already set up. This guide is aimed at users of VMware Player and Server editions (I am using VMware Player).</p>
<p>VMware Player is a simple:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> vmware-player</pre></div></div>

<p>away. For the Server edition, you&#8217;ll probably want to <a href="http://ubuntuguide.org/wiki/Ubuntu:Feisty#How_to_install_Windows_Applications_.28VMWare_Server_or_Workstation.29" alt="VMware Server guide">consult the wiki</a>.</p>
<h3>Install Samba</h3>
<p>If you don&#8217;t already have Samba installed, now would be a good time to do it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> samba</pre></div></div>

<p>In order to keeps things clean and easy to manage, we&#8217;ll set up a new user account to own the share. This account name will be used when connecting to the share from within Windows. For the purposes of illustration, I will be creating a share called <em>sandbox</em> with the username and group also being <em>sandbox</em>.</p>
<p>Create the new group and user account with no login privileges:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> groupadd sandbox
<span style="color: #c20cb9; font-weight: bold;">sudo</span> useradd <span style="color: #660033;">--gid</span> sandbox <span style="color: #660033;">--shell</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> sandbox</pre></div></div>

<p>To avoid creating a redundant home directory, you can add:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #660033;">--home</span> <span style="color: #000000; font-weight: bold;">/</span>nonexistent</pre></div></div>

<p>to the end of the previous command.</p>
<p>Now you need to add a matching Samba account. You&#8217;ll be prompted to set a password &#8211; make note of this as this is what you will use to connect to the share from within Windows.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> smbpasswd <span style="color: #660033;">-a</span> sandbox</pre></div></div>

<p>Next you&#8217;ll need to create a directory to be used as the share (assuming you don&#8217;t already have one). Create a directory, setting the username to your usual login and group to <em>sandbox</em>. Then <strong>chmod</strong> the directory 775 (assuming you wish both yourself and the virtual appliance to have read/write access). Here is what I entered:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">cd $HOME
mkdir sandbox
sudo chown russ:sandbox sandbox
sudo chmod 775 sandbox</pre></div></div>

<p>When you write to the share from within Ubuntu, new files will be created with the default permissions 644 with the username and group being your own user account. When your Windows client connects to the share, it will access it as if it were the local system user <em>sandbox</em> and so the group permissions will apply and you won&#8217;t be able to write to any files created from within Ubuntu.</p>
<p>To get around this problem, we can set the groupid bit for the <em>sandbox</em> directory which means all new files created will inherit the permissions of the parent and so the <em>sandbox</em> user from within Windows will be able to make read and write changes as desired.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> g+s sandbox</pre></div></div>

<p>If you don&#8217;t understand the above, don&#8217;t worry, just chmod the directory with the command above and all should be well.</p>
<h3>Setting up the Samba share</h3>
<p>Now all that&#8217;s left to do is to tell Samba about our share. Open up <em>/etc/samba/smb.conf</em> in your favourite text editor.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf</pre></div></div>

<p>Firstly, we need to set the security mechanism to <em>user</em>. Look for the line:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">security = user</pre></div></div>

<p>and make sure it is uncommented (remove the preceding semicolon if there is one).</p>
<p>Now, scroll down to the <em>Share Definitions</em> section and add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[sandbox]
path = /home/russ/sandbox
valid users = sandbox
read only = No
create mask = 0777
directory mask = 0777</pre></div></div>

<p>Be sure to set the correct path to your share. Save the file and restart the Samba daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>samba restart</pre></div></div>

<p>That should be it. You should now be able to connect to your share from within the Windows guest. At this point you need to know what IP address to connect to from within Windows. This depends on what networking mode you are using for your virtual appliance.</p>
<h4>Bridged Networking</h4>
<p>In this mode, your guest OS has its own IP address and so the address it needs to connect to is your usual host machine&#8217;s address. In this case your address is probably the top line from the output of this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;inet addr:&quot;</span></pre></div></div>

<h4>NAT networking</h4>
<p>In this mode, your guest OS shares your host&#8217;s address (in terms of other machines on the LAN) and communicates with the host via a private network. In this case, the IP address you need to connect to is most likely the bottom one from the output of this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;inet addr:&quot;</span></pre></div></div>

<h3>Connecting to the share from within Windows</h3>
<p>If you are unsure as to your host&#8217;s IP address, try and ping it first from within the Windows guest to confirm you have the right one.</p>
<p><img src="http://2tap.com/blog/wp-content/uploads/2007/04/vmware-windows-guest.gif" alt="Windows Map Networking Drive dialog" /></p>
<p>Having worked out what IP address to connect to, you should now be able to connect to your share from within Windows.</p>
<p>The easiest way to do this is:</p>
<ol>
<li>Open up <strong>My Computer</strong></li>
<li>Go to the <em>Tools</em> menu and then <em>Map Network Drive</em></li>
<li>Choose a drive letter to map the network share to</li>
<li>In <em>Folder</em>, enter: \\<strong>HOSTIP</strong>\sandbox (replacing <strong>HOSTIP</strong>)</li>
<li>Click &#8220;Connect using a different user name&#8221; and enter:
<ul>
<li>username: sandbox</li>
<li>password: <strong>yourpassword</strong></li>
</ul>
</li>
<li>Click <em>OK</em> and then the <em>Finish</em> button to connect</li>
</ol>
<p>Hopefully, congratulations are in order. If not, be sure to make sure that any firewalls you have running (host or guest) have the correct rules set to allow communication between the two systems.</p>
<h3>A note on security</h3>
<p>At this point, assuming you have a successful connection, it is worth noting that any other machine on your local network (and potentially the internet if you are not behind a NAT or firewall) can connect to your share (assuming they have the correct credentials).</p>
<p>If you are only using Samba for sharing with VMware (as I am), you may wish to restrict access to VMware only. This is quite easy to do since VMware creates virtual network interfaces for communication between hosts and guests. This means we can set Samba up to ignore any communications that do not originate from these interfaces.</p>
<p>To do this, open up your Samba configuration file again:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf</pre></div></div>

<p>Make sure you have a:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">bind interfaces only = true</pre></div></div>

<p>line and that it is uncommented (remove any preceding semicolons). Just above this should be an <em>interfaces</em> line (most likely commented out). Add the following just below this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">interfaces = vmnet0 vmnet1 vmnet8</pre></div></div>

<p>These are the virtual interfaces VMware uses for each type of virtual networking: bridged, host only and NAT respectively.</p>
<p>After making the changes, you will need to restart Samba again:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>samba restart</pre></div></div>

<p>and possibly shutdown your VMware session and restart the VMware service:</p>
<p>VMware Player:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vmware-player restart</pre></div></div>

<p>VMware Server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vmware restart</pre></div></div>

<h3>Finished</h3>
<p>You should now have a Samba share configured which is only accessible from your VMware guest appliances. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://2tap.com/2007/04/22/sharing-files-between-a-windows-guest-and-ubuntu-host-using-vmware-and-samba/feed/</wfw:commentRss>
		<slash:comments>85</slash:comments>
		</item>
	</channel>
</rss>

