<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ben Biddington</title>
	<atom:link href="http://benbiddington.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://benbiddington.wordpress.com</link>
	<description>Whatever it is, it&#039;s not about &#34;coding&#34;</description>
	<lastBuildDate>Tue, 29 Nov 2011 23:41:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='benbiddington.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ben Biddington</title>
		<link>http://benbiddington.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://benbiddington.wordpress.com/osd.xml" title="Ben Biddington" />
	<atom:link rel='hub' href='http://benbiddington.wordpress.com/?pushpress=hub'/>
		<item>
		<title>RSpec &#8212; common base specs</title>
		<link>http://benbiddington.wordpress.com/2010/11/06/rspec-common-base-specs/</link>
		<comments>http://benbiddington.wordpress.com/2010/11/06/rspec-common-base-specs/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 00:37:13 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=2233</guid>
		<description><![CDATA[Sometimes I am fond of creating inheritance chains for tests, which is easy in Java or C# say, but not quite as obvious in rspec. Define and register a base class It just needs to inherit from Spec::Example::ExampleGroup so it&#8217;s runnable. require 'spec/example/example_group' class UnitTest &#60; Spec::Example::ExampleGroup  protected def you_can_call_this end end Spec::Example::ExampleGroupFactory.register(:unit_test, UnitTest) Set [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2233&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes I am fond of creating inheritance chains for tests, which is easy in Java or C# say, but not quite as obvious in rspec.</p>
<h2>Define and register a base class</h2>
<p>It just needs to inherit from <em>Spec::Example::ExampleGroup</em> so it&#8217;s runnable.</p>
<pre>require 'spec/example/example_group'
class UnitTest &lt; Spec::Example::ExampleGroup
   protected
   def you_can_call_this
   end
end

Spec::Example::ExampleGroupFactory.register(:unit_test, UnitTest)</pre>
<h2>Set the type when describing</h2>
<pre>describe 'By supplying the :type', :type =&gt; :unit_test do
    it 'this example group inherits from whatever class you supply as :type' do
        self.protected_methods.should include('you_can_call_this')
    end
end</pre>
<p>You now have common base class to your specifications.</p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/bdd/'>bdd</a>, <a href='http://benbiddington.wordpress.com/tag/rspec/'>rspec</a>, <a href='http://benbiddington.wordpress.com/tag/tdd/'>tdd</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/2233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/2233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/2233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/2233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/2233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/2233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/2233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/2233/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2233&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/11/06/rspec-common-base-specs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>Test driving and test coverage</title>
		<link>http://benbiddington.wordpress.com/2010/10/07/test-driving-and-test-coverage/</link>
		<comments>http://benbiddington.wordpress.com/2010/10/07/test-driving-and-test-coverage/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 00:37:10 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=2247</guid>
		<description><![CDATA[Yesterday I enabled rcov on my current project and was surprised that it had 100 per cent unit test coverage. But perhaps I should not have been surprised. After all, if you are truly test driving, how could you possibly leave anything uncovered? Tagged: ruby, tdd<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2247&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday I enabled <em>rcov</em> on my current project and was surprised that it had 100 per cent unit test coverage.</p>
<p>But perhaps I should not have been surprised. After all, if you are <strong>truly</strong> test driving, how could you possibly leave anything uncovered?</p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/ruby/'>ruby</a>, <a href='http://benbiddington.wordpress.com/tag/tdd/'>tdd</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/2247/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/2247/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/2247/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/2247/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/2247/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/2247/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/2247/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/2247/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2247&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/10/07/test-driving-and-test-coverage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>Refactoring Example &#8212; Fat Controllers</title>
		<link>http://benbiddington.wordpress.com/2010/08/09/refactoring-example-fat-controllers/</link>
		<comments>http://benbiddington.wordpress.com/2010/08/09/refactoring-example-fat-controllers/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 12:37:30 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=2139</guid>
		<description><![CDATA[We have an MVC controller that takes some input from a user, finds a file in a particular MP3 flavour, and then calculates the hash of the MP3 frames in that file. Here&#8217;s what it looked like to begin with (an arrow means depends on): Mp3HashController &#124;---------------&#62; TrackFileFinder &#124;---------------&#62; StreamHasher &#124;---------------&#62; Log Operation: Take input of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2139&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We have an MVC controller that takes some input from a user, finds a file in a particular MP3 flavour, and then calculates the hash of the MP3 frames in that file.</p>
<p>Here&#8217;s what it looked like to begin with (an arrow means <em>depends on</em>):</p>
<pre style="padding-left:30px;">Mp3HashController
|---------------&gt; TrackFileFinder
|---------------&gt; StreamHasher
|---------------&gt; Log</pre>
<p>Operation:</p>
<ul>
<li>Take input of trackid and format id (both numbers)</li>
<li>Open a stream on the file</li>
<li>Supply that stream to the StreamHasher</li>
<li>Return the hash as text to user</li>
</ul>
<h2>Next requirement &#8212; learning file hashes</h2>
<p>This works as required but we can improve performance by reducing the number of times we calculate a file&#8217;s hash. Assuming each file is static &#8212; i.e., its MP3 frames will never change &#8212; then we only need to calculate its hash once.</p>
<p>Rather than do this every time, we could save the result somewhere &#8212; a database perhaps. Which means we are introducing new behaviour.</p>
<p style="padding-left:30px;"><em>When producing a hash, first check whether it already exists<br />
If it does exist, then return it<br />
Otherwise generate it and store it for next time</em></p>
<p>We could naively add a new <em>HashRepository</em> collaborator:</p>
<pre style="padding-left:30px;">Mp3HashController
|---------------&gt; TrackFileFinder
|---------------&gt; StreamHasher
|---------------&gt; Log
|---------------&gt; HashRepository</pre>
<p>But now our interface is expanding, this has a habit of getting out of control and you can end up with ten constructor arguments. This is commonly known as the &#8220;Too Many Dicks on the Dance Floor&#8221; problem.</p>
<p>So what&#8217;s wrong with it?</p>
<ul>
<li><em>Mp3HashController</em> is no longer composing its behaviour from one layer of abstraction. This notion of learning return values has changed that. It is now exposed to details it shouldn&#8217;t have any knowledge of let alone dependency on.</li>
<li><em>Mp3HashController</em> is now more difficult to test, there are more paths that have to exercised though the same interface</li>
<li>There is new conditional behaviour here that clearly belongs on its own &#8212; clients should not even know this is happening</li>
<li>It is much easier to test the learning behaviour on its own &#8212; I shouldn&#8217;t have to probe a controller</li>
<li>I shouldn&#8217;t have to describe an object&#8217;s behaviour in terms of another objects interface, I should be able to use that object directly</li>
<li>I would likely have to suppress some behaviour(s) while testing others. This will be manifest itself as complicated stubbing</li>
<li>Lots of dependent stubbing. Each of those collaborators are actually collaborators themselves. I think this is a smell. I shouldn&#8217;t have to consider this when unit testing <em>Mp3HashController</em>.</li>
</ul>
<p>There is an opportunity to introduce an abstraction here. If we consider that all <em>Mp3HashController</em> requires is something to get a hash, then we can actually reduce it to:</p>
<pre style="padding-left:30px;">Mp3HashController
|---------------&gt; Log
|---------------&gt; HashRepository</pre>
<p>And then we have a <em>HashRepository</em> implementation like this:</p>
<pre style="padding-left:30px;">LearningHashRepository
|---------------&gt; TrackFileFinder
|---------------&gt; StreamHasher
|---------------&gt; HashRepository</pre>
<p>The <em>LearninghHashRepository</em> has the responsibility of storing any hashes that don&#8217;t exist.</p>
<p>This could probably be condensed even further. <em>TrackFileFinder</em> and <em>StreamHasher</em> represent the concept of obtaining the hash of a file given a track identifier, so they can be combined. This reduces <em>LearningHashRepository</em> to a sort of write-through cache.</p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/mvc/'>mvc</a>, <a href='http://benbiddington.wordpress.com/tag/oop/'>oop</a>, <a href='http://benbiddington.wordpress.com/tag/refactoring/'>refactoring</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/2139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/2139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/2139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2139&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/08/09/refactoring-example-fat-controllers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>SSH, cygwin and domain users</title>
		<link>http://benbiddington.wordpress.com/2010/08/04/ssh-cygwin-and-domain-users/</link>
		<comments>http://benbiddington.wordpress.com/2010/08/04/ssh-cygwin-and-domain-users/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 12:37:22 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[domain-accounts]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=2094</guid>
		<description><![CDATA[Yes you can log in to your local computer via ssh with a domain account. If it seems you can&#8217;t (i.e., your password is rejected) then you  most likely need to export your user accounts and groups so cygwin can see them. Another clue that you need to export is if you get a message [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2094&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes you <strong>can</strong> log in to your local computer via ssh with a domain account.</p>
<p>If it seems you can&#8217;t (i.e., your password is rejected) then you  most likely need to export your user accounts and groups so cygwin can see them.</p>
<p>Another clue that you need to export is if you get a message like:</p>
<pre>Your group is currently "mkpasswd".  This indicates that
the /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] &gt; /etc/passwd
mkgroup  -l [-d] &gt; /etc/group
Note that the -d switch is necessary for domain users.</pre>
<p>To export domain users:</p>
<pre>$ mkpasswd -d &gt;&gt; /etc/passwd</pre>
<p>To export groups:</p>
<pre>$ mkgroup &gt; /etc/group</pre>
<h2>Troubleshooting</h2>
<p><strong>Errors logging in as domain user</strong></p>
<pre>
<div id="_mcePaste">2 [main] -bash 31884 C:\cygwin\bin\bash.exe: ***
    fatal error - couldn't dynamically determine load address for 'WSAGetLastError'
    (handle 0xFFFFFFFF), Win32 error 126</div>
<div id="_mcePaste">Connection to localhost closed.</div>
</pre>
<p>This is because the <a href="http://cygwin.com/ml/cygwin/2010-01/msg00334.html" target="_blank">cygwin sshd service must also run as domain account</a>. I solved this by changing the user to my domain account.</p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/cygwin/'>cygwin</a>, <a href='http://benbiddington.wordpress.com/tag/domain-accounts/'>domain-accounts</a>, <a href='http://benbiddington.wordpress.com/tag/programming/'>programming</a>, <a href='http://benbiddington.wordpress.com/tag/ssh/'>ssh</a>, <a href='http://benbiddington.wordpress.com/tag/windows/'>windows</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/2094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/2094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/2094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/2094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/2094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/2094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/2094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/2094/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2094&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/08/04/ssh-cygwin-and-domain-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>Why can&#8217;t I hang an extension method on a type?</title>
		<link>http://benbiddington.wordpress.com/2010/08/04/why-cant-i-hang-an-extension-method-on-a-type/</link>
		<comments>http://benbiddington.wordpress.com/2010/08/04/why-cant-i-hang-an-extension-method-on-a-type/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 08:15:44 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cil]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[ildasm]]></category>
		<category><![CDATA[oop]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=1977</guid>
		<description><![CDATA[My brother asked me this. And while I don&#8217;t know, I did discover some interesting things along the way. An extension method is nothing more than a compiler trick. It is simply a static method that takes an instance of the type being extended as an argument. That&#8217;s it. The sugar part is that to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1977&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/benbiddington/2713618025/" target="_blank">My brother</a> asked me this. And while I don&#8217;t know, I did discover some interesting things along the way.</p>
<p>An extension method is nothing more than a compiler trick. It is simply a static method that takes an instance of the type being extended as an argument. That&#8217;s it.</p>
<p>The sugar part is that to you as a programmer, it appears to read more naturally in some cases.</p>
<p>They do not have any special privileges on private or protected members and they are not analagous to ruby module mixins (because the extended class cannot invoked extension methods).</p>
<p>[TBD: It is interesting that instance methods are supplied "this" as their first argument, see CIL]</p>
<p>[TBD: It is interesting that the compiler emits a <em>callvirt</em> instruction even in cases where <em>call</em> seems more appropriate just because <em>callvirt</em> has a null reference check. See: <a href="http://blogs.msdn.com/b/ericgu/archive/2008/07/02/why-does-c-always-use-callvirt.aspx" target="_blank">Why does C# always use callvirt?</a>]</p>
<p>[TBD: Extensions are really a higher level abstraction because they operate only against public interface. An extension method is a <strong>client of</strong> the object it "extends"]</p>
<h2>Example</h2>
<pre>namespace Examples {
    public class ExampleClass { }

    public static class Extensions {
        public static void ExtensionMethod(this ExampleClass instance) {
            instance.ToString();
        }
    }

    public class ThatUsesExampleClass {
        public void RunExample() {
            new ExampleClass().ExtensionMethod();
        }
    }
}</pre>
<div>
<p>The interesting part is <em>RunExample</em> (because it invokes the extension method):</p>
<pre>public void RunExample() {
    new ExampleClass().ExtensionMethod();
}</pre>
<p>which compiles to:</p>
</div>
<pre>.method public hidebysig instance void
RunExample() cil managed
{
    // Code size       13 (0xd)
    .maxstack  8
    IL_0000:  nop
    IL_0001:  newobj     instance void Examples.ExampleClass::.ctor()
    IL_0006:  call       void Examples.Extensions::ExtensionMethod(class Examples.ExampleClass)
    IL_000b:  nop
    IL_000c:  ret
} // end of method ThatUsesExampleClass::RunExample</pre>
<p>It is clear that the compiler has done nothing more than redirect to a static method on a static class:</p>
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">IL_0006:  call       void Examples.Extensions::ExtensionMethod(class Examples.ExampleClass)</pre>
<h2>Usage</h2>
<p>The usual static method usage rules apply:</p>
<blockquote><p>[<a href="http://blog.objectmentor.com/articles/2008/04/08/clean-code-whew" target="_blank">Clean code</a> chapter 6]<br />
Procedural code (code using data structures) makes it easy to add new functions withoutchanging the existing data structures. OO code, on the other hand, makes it easy to add new classes without changing existing functions.</p>
<p>The complement is also true:<br />
Procedural code makes it hard to add new data structures because all the functions must<br />
change. OO code makes it hard to add new functions because all the classes must change.<br />
So, the things that are hard for OO are easy for procedures, and the things that are<br />
hard for procedures are easy for OO!</p>
<p>In any complex system there are going to be times when we want to add new data<br />
types rather than new functions. For these cases objects and OO are most appropriate. On<br />
the other hand, there will also be times when we’ll want to add new functions as opposed<br />
to data types. In that case procedural code and data structures will be more appropriate.</p>
<p>Mature programmers know that the idea that everything is an object is a myth. Sometimes<br />
you really do want simple data structures with procedures operating on them.</p></blockquote>
<div>[TBD: Usage -- how does it fit with OO design?]</div>
<h2>Back to the question</h2>
<p>Still no answer.</p>
<p>But I can&#8217;t see any reason why the C# compiler couldn&#8217;t do the same for static constructs, but I wonder how you would express that on the extension method itself.  Perhaps that&#8217;s where the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.extensionattribute.aspx" target="_blank">ExtensionAttribute</a> comes in. Note: It currently is illegal to use the ExtensionAttribute directly.</p>
<p>But if you examine the IL for an extension method itself, you&#8217;ll see it has been applied:</p>
<pre>.custom instance void [System.Core]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() =
    ( 01 00 00 00 )
.method public hidebysig static void
    ExtensionMethod(class Examples.ExampleClass 'instance') cil managed {

    .custom instance void [System.Core]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() =
        ( 01 00 00 00 ) 

    // Code size       9 (0x9)
    .maxstack  8
    IL_0000:  nop
    IL_0001:  ldarg.0
    IL_0002:  callvirt   instance string [mscorlib]System.Object::ToString()
    IL_0007:  pop
    IL_0008:  ret
} // end of method Extensions::ExtensionMethod</pre>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/net/'>.net</a>, <a href='http://benbiddington.wordpress.com/tag/c/'>c#</a>, <a href='http://benbiddington.wordpress.com/tag/cil/'>cil</a>, <a href='http://benbiddington.wordpress.com/tag/extension/'>extension</a>, <a href='http://benbiddington.wordpress.com/tag/ildasm/'>ildasm</a>, <a href='http://benbiddington.wordpress.com/tag/oop/'>oop</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/1977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/1977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/1977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/1977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/1977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/1977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/1977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/1977/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1977&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/08/04/why-cant-i-hang-an-extension-method-on-a-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>FTP command line fu</title>
		<link>http://benbiddington.wordpress.com/2010/08/03/ftp-command-line-fu/</link>
		<comments>http://benbiddington.wordpress.com/2010/08/03/ftp-command-line-fu/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 12:37:35 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=2045</guid>
		<description><![CDATA[The Windows FTP utility can be easily automated, but if you want to record the output from a session it appears you need to do things in a particular way. Redirection It appears this does not work as expected, i.e. you can&#8217;t redirect stdout from an interactive ftp session to local file. It creates the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2045&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Windows FTP utility can be easily automated, but if you want to record the output from a session it appears you need to do things in a particular way.</p>
<h2>Redirection</h2>
<p>It appears this does not work as expected, i.e. you can&#8217;t redirect stdout from an interactive ftp session to local file. It creates the file but with nothing in it.</p>
<p>Solution is to run ftp with the -s option which specifies a file containing the full list of commands to be run (including log-in).</p>
<pre>&gt; ftp -s:commands.txt &gt; out/result.txt</pre>
<p>Where your commands list looks like this example that prints the contents of a directory called <em>phils_lunchbox</em> :</p>
<pre>open host_or_ip_address port
username
Password
cd phils_lunchbox
ls -l
quit</pre>
<div>Done.</div>
<h2>Tips</h2>
<div>
<ul>
<li>Don&#8217;t forget to add the <em>quit</em> or <em>bye</em> command at the end otherwise your command line&#8217;ll hang</li>
</ul>
</div>
<h2>References</h2>
<div>
<ul>
<li><a href="http://www.nsftools.com/tips/MSFTP.htm#open" target="_blank">Windows FTP</a></li>
<li><a href="http://linux.about.com/od/commands/l/blcmdl1_ftp.htm" target="_blank">FTP command reference</a></li>
</ul>
</div>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/automation/'>automation</a>, <a href='http://benbiddington.wordpress.com/tag/command-line/'>command-line</a>, <a href='http://benbiddington.wordpress.com/tag/ftp/'>ftp</a>, <a href='http://benbiddington.wordpress.com/tag/windows/'>windows</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/2045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/2045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/2045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/2045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/2045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/2045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/2045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/2045/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2045&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/08/03/ftp-command-line-fu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>Outside-in development taken too far</title>
		<link>http://benbiddington.wordpress.com/2010/08/03/outside-in-development-taken-too-far/</link>
		<comments>http://benbiddington.wordpress.com/2010/08/03/outside-in-development-taken-too-far/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 12:37:12 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[outside-in]]></category>
		<category><![CDATA[plonker]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=2014</guid>
		<description><![CDATA[You may feel someone is taking things too far when you receive a set of scenarios like this: Scenario 1: Warm Teapot Given a Kettle of Boiling Water When Boiling Water is poured in to the Teapot Then it should* warm the Teapot Scenario 2: Brewing the tea Given a Kettle of Boiling Water And [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2014&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You may feel someone is taking things too far when you receive a set of scenarios like this:</p>
<p><span style="text-decoration:underline;">Scenario 1: Warm Teapot</span></p>
<p>Given a Kettle of Boiling Water<br />
When Boiling Water is poured in to the Teapot<br />
Then it should* warm the Teapot</p>
<p><span style="text-decoration:underline;">Scenario 2: Brewing the tea</span></p>
<p>Given a Kettle of Boiling Water<br />
And 5 Teabags<br />
When 5 Teabags are placed in the Teapot<br />
And Boiling Water is poured in to the Teapot<br />
And the Teapot is left with the above ingredients in it for 5 minutes<br />
Then you should have Brewed Tea</p>
<p><span style="text-decoration:underline;">Scenario 3: Pouring the tea</span></p>
<p>Given a Teapot of Brewed Tea<br />
And a Mug with some Milk in it**<br />
When the Brewed Tea is poured in to the Mug<br />
Then you should have a Perfect Cup of Tea</p>
<p>* &#8220;Do or do not. There is no should&#8221;<br />
** Debatable. I think we need to triangulate this, or consult the client.</p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/bdd/'>bdd</a>, <a href='http://benbiddington.wordpress.com/tag/cucumber/'>cucumber</a>, <a href='http://benbiddington.wordpress.com/tag/outside-in/'>outside-in</a>, <a href='http://benbiddington.wordpress.com/tag/plonker/'>plonker</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/2014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/2014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/2014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/2014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/2014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/2014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/2014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/2014/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=2014&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/08/03/outside-in-development-taken-too-far/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>How to host a website from home</title>
		<link>http://benbiddington.wordpress.com/2010/05/04/how-to-host-a-website-from-home/</link>
		<comments>http://benbiddington.wordpress.com/2010/05/04/how-to-host-a-website-from-home/#comments</comments>
		<pubDate>Tue, 04 May 2010 12:37:16 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[585]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[port_forwarding]]></category>
		<category><![CDATA[speedtouch_585]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=1646</guid>
		<description><![CDATA[My weekend project for the last couple of weeks has been to find out how to expose a website from my home computer. And after doing so, it appears there are two requirements: Instructing firewall to forward ports Allowing requests through firewall on the target computer I am using a SpeedTouch 585 forwarding to a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1646&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My weekend project for the last couple of weeks has been to find out how to expose a website from my home computer.</p>
<p>And after doing so, it appears there are two requirements:</p>
<ol>
<li>Instructing firewall to forward ports</li>
<li>Allowing requests through firewall on the target computer</li>
</ol>
<p>I am using a <em>SpeedTouch 585</em> forwarding to a laptop running <em>Windows 7</em>.</p>
<p>It is also recommended of course that you have a static ip address.</p>
<h2>How to instruct router to forward a port</h2>
<p><strong>TIP</strong>: Ensure you don&#8217;t have an ip address conflict (i.e., more than one computer on the same ip address) on your network, perhaps that confuses things for forwarding. Giving whatever machine you&#8217;re forwarding to a static ip address probably makes sense &#8212; you won&#8217;t need to change anything when that machine joins network then.</p>
<p>I have a <em>SpeedTouch 585</em>, and I did it through the web interface:</p>
<ul>
<li>Go to: &#8220;Home &gt; Home Network &gt; Devices &gt; [device name]&#8220;</li>
<li>Select &#8220;Configure&#8221; from the upper right part of the screen (between &#8220;Overview&#8221; and &#8220;Help&#8221;)</li>
<li>From the &#8220;Connection Sharing&#8221; section, select &#8220;HTTP Server (World Wide Web)&#8221; from the list and press the &#8220;Add&#8221; button</li>
<li>You&#8217;re now forwarding all HTTP requests to your public ip address on port 80 to your selected device on port 80.</li>
</ul>
<p>There are full also instructions for <a href="http://portforward.com/english/routers/port_forwarding/Thomson-Alcatel/SpeedTouch585/Utorrent.htm" target="_blank">port forwarding on a SpeedTouch 585</a>.</p>
<p><strong>TIP</strong>: You can telnet straight in to router on default port (23), bypassing the web UI.</p>
<p><strong>TIP</strong>: Windows 7 has telnet disabled. Search for &#8220;turn Windows features on or off&#8221; to get the applet for enabling it.</p>
<h3>Adding new firewall rules</h3>
<p>Firewall rules are edited and applied through the &#8220;Game &amp; Application Sharing&#8221; section.</p>
<p>For example. you may wish to host a website on port 99 on your laptop:</p>
<ul>
<li>Go to &#8220;Home &gt; Toolbox &gt; Game &amp; Application Sharing&#8221;</li>
<li>From the &#8220;Pick a task&#8230;&#8221; section, choose &#8220;Create a new game or application&#8221;</li>
<li>From the &#8220;Clone Existing Game or Application&#8221; list, choose &#8220;HTTP Server (World Wide Web)&#8221;</li>
<li>Check &#8220;Manual Entry of Port Maps&#8221;</li>
<li>Press &#8220;Next&#8221;</li>
<li>Enter 80 and 80 as the &#8220;Port Range&#8221;</li>
<li>Enter 99 as the &#8220;Translate to&#8221;</li>
<li>That&#8217;s it</li>
</ul>
<p>Here&#8217;s the resultant mapping:</p>
<pre>Protocol  Port Range	Translate To ...  Trigger Protocol  Trigger Port
Any	  80 - 80	99 - 99		  -		    -</pre>
<p><strong>TIP</strong>: You cannot edit anything in the &#8220;Home &gt; Toolbox &gt; Game &amp; Application Sharing &gt; Game or Application Definition&#8221; list if it is assigned to something (The edit link is missing). Unassign it before you edit it.</p>
<p><strong>TIP</strong>: You have to explicitly enable logging for each &#8220;Game of Application&#8221; you attach to a device, otherwise you&#8217;ll get no logging at all.</p>
<h3>What forwarding rules really look like</h3>
<p>In the event logs, here&#8217;s what I get when I run a <a href="http://www.yougetsignal.com/tools/open-ports/" target="_blank">test</a> with port 80:</p>
<pre>FIREWALL rule (1 of 1) : Protocol: TCP
Src ip: 69.163.149.200
Src port: 47603
Dst ip: 192.168.1.65
Dst port: 99
Chain: forward_host_service
Rule Id: 2
Action: accept</pre>
<p>Even though it does display an amber light instead of green, I think this is just a forwarding record, not a warning.</p>
<p>That stuff about the <em>forward_host_service</em> chain is available via telnet. Telnet in to your router and open the chains list.</p>
<p>Here are the chains I have:</p>
<pre>Name                                             Description
-----------------------------------------------------------------
sink                                             system
forward                                          system
source                                           system
sink_fire                                        system
forward_fire                                     system
source_fire                                      system
forward_host_service                             system
forward_level                                    system
sink_system_service                              system
forward_multicast                                system
forward_level_BlockAll                           system
forward_level_Standard                           system
forward_level_Disabled                           system</pre>
<p>Which includes <em>forward_host_service, </em>which contains these rules (including number 3):</p>
<pre>:firewall rule list chain=forward_host_service format=cli

:firewall rule add chain=forward_host_service index=1
    name=_f_u_192.168.1.65:55768_55768
    dstip=_u_192.168.1.65
    serv=_u_17:55768_55768
    log=disabled
    state=enabled
    action=accept

:firewall rule add chain=forward_host_service index=2
    name=_f_sv_192.168.1.65:80_80
    dstip=_sv_192.168.1.65
    serv=_sv_6:99_99
    log=disabled
    state=enabled
    action=accept

:firewall rule add chain=forward_host_service index=3
    name=_f_sv_192.168.1.65:3128_3128
    dstip=_sv_192.168.1.65
    serv=_sv_6:3128_3128
    log=enabled
    state=enabled
    action=accept</pre>
<h2>How to allow connections through your firewall</h2>
<p>Depends on your vendor obviously, but I am running ESET and I did this:</p>
<ol>
<li>Setup &gt; Personal firewall &gt; Configure rules and zones&#8230;</li>
<li>Add new rule: TCP &amp; UDP, port 80, All remote ports, All addresses</li>
</ol>
<h3>Coping with rejection</h3>
<p>If you&#8217;ve gotten this far, then your router is forwarding as expected, but the test may still be failing. The next place to look then is on the machine being forwarded to.</p>
<p>Inspect the firewall logs on the target machine and you should have something like:</p>
<pre>Packet blocked by active defense (IDS)
192.168.1.65:99
69.163.149.200:41791
TCP</pre>
<p>So I had to add a new firewall rule.</p>
<p>If you have problems with your rules, put the firewall into interactive mode (this will prompt you to allow or deny all incoming requests), run the test, accept the connection and inspect the rule it generates.</p>
<p><strong>TIP</strong>: Take care with the executable, try the rule with and without to see if it makes a difference.</p>
<h2>How to test your router is open on a particular port</h2>
<p>Try <a href="http://www.yougetsignal.com/tools/open-ports/" target="_blank">this utility</a>.</p>
<h2>Troubleshooting</h2>
<h3>Where are the SpeedTouch router log files?</h3>
<p>Home &gt; SpeedTouch &gt; Event Logs</p>
<h2>References</h2>
<ul>
<li><a href="http://squid.acmeconsulting.it/" target="_blank">Squid (Windows)</a></li>
<li><a href="http://www.yougetsignal.com/tools/open-ports/" target="_blank">You get signal (tests port forwarding)</a></li>
<li><a href="http://portforward.com/english/routers/port_forwarding/Thomson-Alcatel/SpeedTouch585/Utorrent.htm" target="_blank">Illustrated instructions</a> for configuring port forwarding in SpeedTouch 585</li>
</ul>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/585/'>585</a>, <a href='http://benbiddington.wordpress.com/tag/firewall/'>firewall</a>, <a href='http://benbiddington.wordpress.com/tag/hosting/'>hosting</a>, <a href='http://benbiddington.wordpress.com/tag/howto/'>howto</a>, <a href='http://benbiddington.wordpress.com/tag/port_forwarding/'>port_forwarding</a>, <a href='http://benbiddington.wordpress.com/tag/speedtouch_585/'>speedtouch_585</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/1646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/1646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/1646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/1646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/1646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/1646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/1646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/1646/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1646&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/05/04/how-to-host-a-website-from-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>Whose leg do I have to hump to get a Facebook developers forum account?</title>
		<link>http://benbiddington.wordpress.com/2010/04/29/whose-leg-do-i-have-to-hump-to-get-a-facebook-developers-forum-account/</link>
		<comments>http://benbiddington.wordpress.com/2010/04/29/whose-leg-do-i-have-to-hump-to-get-a-facebook-developers-forum-account/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 12:37:04 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[graph_api]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=1607</guid>
		<description><![CDATA[How does one go about registering for the Facebook developer forum? Filling out the form Produces &#8220;Could not open socket&#8221; error in Chrome and Firefox. Facebook Connect On the register screen there is a Facebook Connect option, but this does nothing in Chrome, and does not appear at all in Internet Explorer. Firefox does produce [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1607&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How does one go about registering for the <a href="http://forum.developers.facebook.com/" target="_blank">Facebook developer forum</a>?</p>
<h3>Filling out the form</h3>
<p>Produces &#8220;Could not open socket&#8221; error in <em>Chrome</em> and <em>Firefox</em>.</p>
<h3>Facebook Connect</h3>
<p>On the register screen there is a Facebook Connect option, but this does nothing in <em>Chrome</em>, and does not appear at all in <em>Internet Explorer.</em></p>
<p><em>Firefox </em>does produce the window, so I select yes or whatever but then I can still not sign in.</p>
<p>Then I ask for my password to be sent, only to be told there is no account for my address.</p>
<p>Okay, then I think perhaps I don&#8217;t need to sign in to access the forum. I sign in to facebook and revisit: still can&#8217;t do anything but read posts.</p>
<h3>In other news</h3>
<p>Interestingly I do have <em>punBB</em> listed on my <a href="http://www.facebook.com/#!/editapps.php?v=allowed" target="_blank">Application settings screen</a>.</p>
<p><em><br />
</em></p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/facebook/'>facebook</a>, <a href='http://benbiddington.wordpress.com/tag/forum/'>forum</a>, <a href='http://benbiddington.wordpress.com/tag/graph_api/'>graph_api</a>, <a href='http://benbiddington.wordpress.com/tag/howto/'>howto</a>, <a href='http://benbiddington.wordpress.com/tag/wtf/'>wtf</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/1607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/1607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/1607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/1607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/1607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/1607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/1607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/1607/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1607&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/04/29/whose-leg-do-i-have-to-hump-to-get-a-facebook-developers-forum-account/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
		<item>
		<title>2010-04-04 &#8212; new signature</title>
		<link>http://benbiddington.wordpress.com/2010/04/28/2010-04-04-new-signature/</link>
		<comments>http://benbiddington.wordpress.com/2010/04/28/2010-04-04-new-signature/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 12:37:43 +0000</pubDate>
		<dc:creator>benbiddington</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[diary]]></category>
		<category><![CDATA[and_that]]></category>
		<category><![CDATA[dorky]]></category>
		<category><![CDATA[family]]></category>
		<category><![CDATA[max]]></category>

		<guid isPermaLink="false">http://benbiddington.wordpress.com/?p=1600</guid>
		<description><![CDATA[My customary signature has officially changed from: &#60;bb /&#62; to: &#60;bb&#62;     &#60;mb /&#62; &#60;/bb&#62; Many thanks and kind regards. Tagged: and_that, dorky, family, max<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1600&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My customary signature has officially changed from:</p>
<pre>&lt;bb /&gt;</pre>
<p>to:</p>
<pre>&lt;bb&gt;
    &lt;mb /&gt;
&lt;/bb&gt;</pre>
<p>Many thanks and kind regards.</p>
<br /> Tagged: <a href='http://benbiddington.wordpress.com/tag/and_that/'>and_that</a>, <a href='http://benbiddington.wordpress.com/tag/dorky/'>dorky</a>, <a href='http://benbiddington.wordpress.com/tag/family/'>family</a>, <a href='http://benbiddington.wordpress.com/tag/max/'>max</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benbiddington.wordpress.com/1600/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benbiddington.wordpress.com/1600/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benbiddington.wordpress.com/1600/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benbiddington.wordpress.com/1600/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benbiddington.wordpress.com/1600/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benbiddington.wordpress.com/1600/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benbiddington.wordpress.com/1600/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benbiddington.wordpress.com/1600/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benbiddington.wordpress.com&amp;blog=4897330&amp;post=1600&amp;subd=benbiddington&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benbiddington.wordpress.com/2010/04/28/2010-04-04-new-signature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c353e0b30deeaa442e12967de79dcbdb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ben.biddington</media:title>
		</media:content>
	</item>
	</channel>
</rss>
