<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.5" -->
<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/"
	>

<channel>
	<title>chris clarke</title>
	<link>http://squadlimber.com/chris</link>
	<description>software development that works...or something</description>
	<pubDate>Mon, 07 Apr 2008 23:14:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>
	<language>en</language>
			<item>
		<title>Using an SVN client with Team Foundation Server</title>
		<link>http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/</link>
		<comments>http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 18:52:37 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Continuous Integration</category>

		<category>Tools n Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/</guid>
		<description><![CDATA[Tim Goodwin blogs about SvnBridge.  Its a tool for being able to use Subversion clients with Team Foundation Server.  I quite like the idea of creating good interfaces to bad systems, however it would be much easier if people stopped making bad systems.

]]></description>
			<content:encoded><![CDATA[<p><a href="http://trgoodwin.blogspot.com/2007/11/interesting-tool-svnbridge.html">Tim Goodwin</a> blogs about <a href="http://www.codeplex.com/SvnBridge">SvnBridge</a>.  Its a tool for being able to use <a href="http://subversion.tigris.org/">Subversion</a> clients with <a href="http://en.wikipedia.org/wiki/Team_Foundation_Server">Team Foundation Server</a>.  I quite like the idea of creating good interfaces to bad systems, however it would be much easier if people stopped making bad systems.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mocking Concrete Classes in JMock 2</title>
		<link>http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/</link>
		<comments>http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 10:44:22 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Tools n Stuff</category>

		<category>Testing</category>

		<category>Java</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/</guid>
		<description><![CDATA[In JMock 1 you extended the cglib version of MockObjectTestCase but in JMock 2 its different.  You need to change the Imposteriser used by the Mockery:

Mockery context = new Mockery&#40;&#41;;
context.setImposteriser&#40;ClassImposteriser.INSTANCE&#41;;
&#160;
]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.jmock.org/">JMock 1</a> you extended the cglib version of MockObjectTestCase but in <a href="http://www.jmock.org/">JMock 2</a> its different.  You need to change the Imposteriser used by the Mockery:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
Mockery context = <span style="color: #000080;">new</span> Mockery<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
context.<span style="color: #000000;">setImposteriser</span><span style="color: #000000;">&#40;</span>ClassImposteriser.<span style="color: #000000;">INSTANCE</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tool Support For JavaScript</title>
		<link>http://squadlimber.com/chris/2007/08/06/tool-support-for-javascript/</link>
		<comments>http://squadlimber.com/chris/2007/08/06/tool-support-for-javascript/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 00:57:04 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Tools n Stuff</category>

		<category>Testing</category>

		<category>JavaScript</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/08/06/tool-support-for-javascript/</guid>
		<description><![CDATA[Oh dear, what happened to my clever navigation and code-completion? The IDE support for JavaScript is still catching up with Java, if you have only small amounts of JavaScript you&#8217;ll be fine with TextMate or something similar.  But for large class-based projects you&#8217;ll need something else.

The best thing at the moment is IntelliJ, its [...]]]></description>
			<content:encoded><![CDATA[<p>Oh dear, what happened to my clever navigation and code-completion? The IDE support for JavaScript is still catching up with Java, if you have only small amounts of JavaScript you&#8217;ll be fine with <a href="http://macromates.com/">TextMate</a> or something similar.  But for large class-based projects you&#8217;ll need something else.</p>
<p><img align="right" id="image81" src="http://squadlimber.com/chris/wp-content/uploads/2007/08/hammers.jpg" alt="hammers.jpg" /></p>
<p>The best thing at the moment is <a href="http://www.jetbrains.com/idea/">IntelliJ</a>, its currently the only thing out there that can navigate <em>across</em> a codebase.  With <a href="http://www.aptana.com/">Aptana</a> or <a href="http://www.eclipse.org/">Eclipse</a>, if the method exists in another file it cannot navigate to it and you&#8217;re forced to resort to searching in files ending with *.js.  Second best is Eclipse 3.3 with the <a href="http://labs.adobe.com/technologies/jseclipse/">JSEclipse 2.0 pre-release</a> installed.  (I&#8217;m really impressed with Eclipse 3.3 - its improved in several places - but I especially like the <a href="http://quicksilver.blacktree.com/">Quicksilver</a> style Ctrl-3 shortcut).</p>
<h3>How hard can unit-testing JavaScript be?</h3>
<p>On the surface of things JavaScript seems to have a lot of the same tools that Java has for unit-testing.  <a href="http://www.jsunit.net/">JSUnit</a> is the JavaScript equivalent of <a href="http://www.junit.org/">JUnit</a> and <a href="http://jsmock.sourceforge.net/">JSMock</a> the equivalent of <a href="http://www.jmock.org/">JMock</a>.</p>
<p>The syntax of JSUnit is fine, its pretty much as you&#8217;d expect and conforms to the XUnit conventions.  The key bit that&#8217;s missing is the fast feedback.  When working on a class you want to be able to run the test often so you can see the immediate effects of changes you&#8217;ve made and the let the test tell you exactly whats wrong.  To run a test with JSUnit, I need to open the JSUnit test runner in a browser, load my test page and then run it.  Once I&#8217;ve run it, assuming its failed I get a list of tests that failed - but not the reason they failed, I need to double-click - then I get an alert telling me why the test failed.  It really interrupts your flow, especially when you&#8217;re flipping between multiple classes.  If you&#8217;re using an IDE with a Browser Preview tab, you can get around this problem with a little JavaScript along the lines of:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #003366; font-weight: bold;">var</span> currentLocation = <span style="color: #3366CC;">&quot;&quot;</span>&nbsp; &nbsp;window.<span style="color: #006600;">location</span>;<br />
window.<span style="color: #006600;">location</span> = <span style="color: #3366CC;">&quot;file:///.../testRunner.html?testpage=&quot;</span>&nbsp; &nbsp;currentLocation&nbsp; <span style="color: #3366CC;">&quot;&amp;amp;autoRun=true&quot;</span>;<br />
&nbsp;</div>
<p>(Sorry plus signs don&#8217;t seem to show up - hopefully you can get the general idea).</p>
<p>I&#8217;ve got this working in Eclipse by installing the <a href="http://prdownloads.sourceforge.jp/amateras/24128/tk.eclipse.plugin.htmleditor_2.0.4.zip">EclipseHTMLEditor plugin</a> and including the following common bit of code in all JSUnit tests:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #003366; font-weight: bold;">var</span> currentLocation = <span style="color: #3366CC;">&quot;&quot;</span>&nbsp; &nbsp;window.<span style="color: #006600;">location</span>;<br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>currentLocation.<span style="color: #006600;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;cacheBuster&quot;</span><span style="color: #66cc66;">&#41;</span> &lt; <span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; window.<span style="color: #006600;">location</span> = <span style="color: #3366CC;">&quot;file:///.../testRunner.html?testpage=&quot;</span>&nbsp; &nbsp;currentLocation&nbsp; <span style="color: #3366CC;">&quot;&amp;amp;autoRun=true&quot;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
&nbsp;</div>
<p>Now a test can be run by just clicking on its Preview tab.</p>
<h3>Making a Mockery</h3>
<p>JSMock is kind of good - at least someone&#8217;s written a mocking framework for JavaScript.  As soon as you start to use it - you realize that it is by know means a mature piece of software.</p>
<p>It doesn&#8217;t give you any kind of useful messages, for example it will say &#8216;Unexpected Arguments&#8217; but won&#8217;t tell you what the actual arguments were against the expected arguments.  Similarly for an unexpected invocation, it won&#8217;t tell you what has been called and what was expected to be called.  The other missing piece is support for literal objects - JSMock gets it wrong if you pass a literal object as an argument.  This is basic stuff - thankfully the code is still quite small and I&#8217;ve found myself adding a lot of these features myself just to be able to use it.</p>
<p>The cool thing about JSMock is that because JavaScript is such a flexible language you don&#8217;t need to put your method calls in strings like in JMock 1 and you can keep using literal language (unlike in JMock 2):</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; server.<span style="color: #006600;">expect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">request</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'/index.jsp'</span>, <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; method: <span style="color: #3366CC;">'get'</span>,<br />
&nbsp; &nbsp; parameters: <span style="color: #66cc66;">&#123;</span> userId: <span style="color: #3366CC;">'fred'</span> <span style="color: #66cc66;">&#125;</span>,<br />
&nbsp; &nbsp; onSuccess: <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><br />
&nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp;</div>
<p>Another cool thing is that if I have static objects as collaborators I can mock those too:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #003366; font-weight: bold;">var</span> mockThing = mockControl.<span style="color: #006600;">createMock</span><span style="color: #66cc66;">&#40;</span>Thing<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #009900; font-style: italic;">// substitute the mock Thing for the real Thing</span><br />
Thing = mockThing;<br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/08/06/tool-support-for-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sloppy Code equals Buggy Code ?</title>
		<link>http://squadlimber.com/chris/2007/04/26/sloppy-code-equals-buggy-code/</link>
		<comments>http://squadlimber.com/chris/2007/04/26/sloppy-code-equals-buggy-code/#comments</comments>
		<pubDate>Thu, 26 Apr 2007 22:35:28 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Tools n Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/04/26/sloppy-code-equals-buggy-code/</guid>
		<description><![CDATA[Having witnessed a lot of bugs recently, big and small, in some legacy code - there seems to be some patterns emerging.  The root causes of the bugs are often found deep inside big classes, often with some suspicious looking commented-out code and the odd TODO floating nearby.  Even when implementing new features, [...]]]></description>
			<content:encoded><![CDATA[<p>Having witnessed a lot of bugs recently, big and small, in some legacy code - there seems to be some patterns emerging.  The root causes of the bugs are often found deep inside big classes, often with some suspicious looking <i style="background: yellow">commented-out code</i> and the odd TODO floating nearby.  Even when implementing new features, I&#8217;ve found myself spending most of my time trawling through these larger species of classes trying to work out what they are doing.  I find myself deleting chunks of commented out code and tripping over <i style="background: yellow">scary looking TODO&#8217;s</i> saying things like &#8216;Fix this when I figure out what it should do&#8217; or &#8216;Hack - fix me&#8217;.  These bigger, sloppier classes are minefields for potential bugs and quicksand for productivity.</p>
<p>Having read <a href="http://ivan.truemesh.com/">Ivan</a> and <a href="http://nat.truemesh.com/">Nat&#8217;s</a> attempt at a <a href="http://ivan.truemesh.com/archives/000676.html">Real-time Sloppographer</a>, from the Scrapheap Challenge at <a href="http://www.spaconference.org/spa2007/index.html">SPA 2007</a>, I was inspired to come up with a similar utility for measuring Sloppiness in the way it had affected me.</p>
<p><b style="color: navy">mostLikelyToBeBuggyTop10.py</b> is a quick bit of python I wrote to measure sloppiness based on the things I&#8217;ve encountered:</p>
<ol>
<li><b>size</b> - bigger files get more sloppy points</li>
<li><b>TODOs</b> - more TODOs, more sloppy points</li>
<li><b>does it have a Test?</b> - if not - more sloppy points</li>
<li><b>number of comments</b> - maybe slightly controversial - but the more comments, the more sloppy points - i&#8217;ve found files with big chunks of commented out code so it&#8217;s useful for me</li>
</ol>
<div class="python" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #808080; font-style: italic;"># mostLikelyToBeBuggyTop10.py</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">re</span>, <span style="color: #dc143c;">sys</span><br />
<br />
todoPattern = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Todo|TODO'</span><span style="color: black;">&#41;</span><br />
commentPattern = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'//'</span><span style="color: black;">&#41;</span><br />
excludePattern = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Test.java'</span><span style="color: black;">&#41;</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> howBuggyIs<span style="color: black;">&#40;</span>javaFile<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; lines = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>javaFile<span style="color: black;">&#41;</span>.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; numberOfLinesMetric = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>lines<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; numberOfCommentsMetric = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>l <span style="color: #ff7700;font-weight:bold;">for</span> l <span style="color: #ff7700;font-weight:bold;">in</span> lines <span style="color: #ff7700;font-weight:bold;">if</span> commentPattern.<span style="color: black;">search</span><span style="color: black;">&#40;</span>l<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #ff7700;font-weight:bold;">not</span> todoPattern.<span style="color: black;">search</span><span style="color: black;">&#40;</span>l<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; numberOfTodosMetric = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>todoPattern.<span style="color: black;">findall</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>lines<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; wouldBeTestName = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>javaFile<span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.java'</span>, <span style="color: #483d8b;">'Test.java'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; hasTest = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>f <span style="color: #ff7700;font-weight:bold;">for</span> f <span style="color: #ff7700;font-weight:bold;">in</span> javaFilesCopy <span style="color: #ff7700;font-weight:bold;">if</span> f.<span style="color: black;">endswith</span><span style="color: black;">&#40;</span>wouldBeTestName<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> &gt; <span style="color: #ff4500;">0</span><br />
<br />
&nbsp; &nbsp; buggyMetric = numberOfLinesMetric <span style="color: black;">&#40;</span>numberOfTodosMetric * <span style="color: #ff4500;">50</span><span style="color: black;">&#41;</span> <span style="color: black;">&#40;</span>numberOfCommentsMetric * <span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> hasTest:<br />
&nbsp; &nbsp; &nbsp; &nbsp; buggyMetric *= <span style="color: #ff4500;">10</span><br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> buggyMetric<br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> bugMetric<span style="color: black;">&#40;</span>x, y<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> howBuggyIs<span style="color: black;">&#40;</span>y<span style="color: black;">&#41;</span> - howBuggyIs<span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span>&nbsp; &nbsp; <br />
<br />
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:<br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> == <span style="color: #ff4500;">1</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Usage: python mostLikelyToBeBuggyTop10.py path [excludePattern]'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'&nbsp; &nbsp; e.g.&nbsp; &nbsp; '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; python mostLikelyToBeBuggyTop10.py .'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; python mostLikelyToBeBuggyTop10.py src/java Test'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> == <span style="color: #ff4500;">3</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; excludePattern = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; javaFiles = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> root, dirs, files <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">walk</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, topdown=<span style="color: #008000;">False</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; javaFiles.<span style="color: black;">extend</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>root, name<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> name <span style="color: #ff7700;font-weight:bold;">in</span> files <span style="color: #ff7700;font-weight:bold;">if</span> name.<span style="color: black;">endswith</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.java'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; javaFilesCopy = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>javaFiles<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; javaFiles.<span style="color: black;">sort</span><span style="color: black;">&#40;</span>bugMetric<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; javaFiles = <span style="color: black;">&#91;</span>f <span style="color: #ff7700;font-weight:bold;">for</span> f <span style="color: #ff7700;font-weight:bold;">in</span> javaFiles <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> excludePattern.<span style="color: black;">search</span><span style="color: black;">&#40;</span>f<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> mostBuggy <span style="color: #ff7700;font-weight:bold;">in</span> javaFiles<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">10</span><span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> mostBuggy<br />
&nbsp;</div>
<p>
Sorry, some characters don&#8217;t show up, such as &#8216;+&#8217;, but you can get the original here: <a href="http://squadlimber.com/chris/mostLikelyToBeBuggyTop10.txt">mostLikelyToBeBuggyTop10.py</a></p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/04/26/sloppy-code-equals-buggy-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Build-o-matic plugin screens</title>
		<link>http://squadlimber.com/chris/2007/01/01/build-o-matic-plugin-screens/</link>
		<comments>http://squadlimber.com/chris/2007/01/01/build-o-matic-plugin-screens/#comments</comments>
		<pubDate>Mon, 01 Jan 2007 17:37:16 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Continuous Integration</category>

		<category>Tools n Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/?p=15</guid>
		<description><![CDATA[Latest screens from build-o-matic plugin for intellij:
Logging in:

After logging in:

(The black box saying &#8216;quick-cruise&#8217; is the build-o-matic build being monitored : it goes red for last build failed, green for success and black if it can&#8217;t find the build-o-matic server (this is because I didn&#8217;t have a build-o-matic running when i took these screenshots))
(The two [...]]]></description>
			<content:encoded><![CDATA[<p>Latest screens from <a target="_blank" href="http://sf.net/projects/build-o-matic">build-o-matic</a> plugin for intellij:</p>
<p>Logging in:</p>
<p><a class="imagelink" title="loggingin.jpg" href="http://squadlimber.com/chris/wp-content/uploads/2007/01/loggingin.jpg"><img id="image12" alt="loggingin.jpg" src="http://squadlimber.com/chris/wp-content/uploads/2007/01/loggingin.jpg" /></a></p>
<p>After logging in:</p>
<p><img id="image13" alt="loggedinas.jpg" src="http://squadlimber.com/chris/wp-content/uploads/2007/01/loggedinas.jpg" /></p>
<p>(The black box saying &#8216;quick-cruise&#8217; is the build-o-matic build being monitored : it goes red for last build failed, green for success and black if it can&#8217;t find the build-o-matic server (this is because I didn&#8217;t have a build-o-matic running when i took these screenshots))</p>
<p>(The two tiny icons are the pictures of the people who are currently logged in (me and no-one))</p>
<p>After I break the build:</p>
<p><a title="blamedialog.jpg" class="imagelink" href="http://squadlimber.com/chris/wp-content/uploads/2007/01/blamedialog.jpg"><img alt="blamedialog.jpg" id="image14" src="http://squadlimber.com/chris/wp-content/uploads/2007/01/blamedialog.thumbnail.jpg" /></a></p>
<p>A picture of our builds (Uh-oh - looks like the e2e build has crashed and the branch build is broken!):</p>
<p><img alt="bompluginscreen.jpg" id="image19" src="http://squadlimber.com/chris/wp-content/uploads/2007/01/bompluginscreen.jpg" /></p>
<h3>Where can I get this plugin?</h3>
<p>Coming soon - currently integrating with main <a target="_blank" href="http://sf.net/projects/build-o-matic">build-o-matic</a> source.</p>
<h3>Is there an eclipse version?</h3>
<p>Yes - but it&#8217;s no where near as good - only has the status bars.</p>
<h3>Comments and feature-suggestions welcome</h3>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/01/01/build-o-matic-plugin-screens/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eclipse vs. IntelliJ : Final Showdown (sort of)</title>
		<link>http://squadlimber.com/chris/2006/12/29/eclipse-vs-intellij-final-showdown/</link>
		<comments>http://squadlimber.com/chris/2006/12/29/eclipse-vs-intellij-final-showdown/#comments</comments>
		<pubDate>Fri, 29 Dec 2006 02:23:25 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Tools n Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/?p=11</guid>
		<description><![CDATA[Having used both Eclipse and IntelliJ for a while now - I&#8217;ve decided to have my own showdown between the two IDEs.  Similar to JK, I&#8217;ll be recording every fault, brilliance, missing feature, annoyance and crash in this blog entry.  After a month or two of using both - I&#8217;ll decide which one [...]]]></description>
			<content:encoded><![CDATA[<p>Having used both <a target="_blank" href="http://www.eclipse.org/">Eclipse</a> and <a target="_blank" href="http://www.jetbrains.com/idea/">IntelliJ</a> for a while now - I&#8217;ve decided to have my own showdown between the two IDEs.  Similar to JK, I&#8217;ll be recording every fault, brilliance, missing feature, annoyance and crash in this blog entry.  After a month or two of using both - I&#8217;ll decide which one has further to go to become King of all Java IDEs.</p>
<p>I&#8217;ve gravitated between the two of them for a while and I&#8217;m probably one of the few who&#8217;s yet to make their mind up.  Rather than knee-jerking between the two I&#8217;ll also be looking for ways around things, and seeing exactly how hard it would be to just dig in and code a plugin for &#8220;But (Eclipse/IntelliJ) doesn&#8217;t have feature X&#8221;.</p>
<ul>
<li>No HTML editor in eclipse - easily solved, installed <a target="_blank" href="http://www.eclipse.org/webtools/">webtools</a>.</li>
<li>No widen selection (Apple-w) in eclipse - not a big thing but a feature that you get really used to in IntelliJ</li>
<li>Lack of an easy way to create a test in IntelliJ - solved by downloading the Test Dox plugin (available from the <a target="_blank" href="http://plugins.intellij.net/">IntelliJ Plugin Repository</a>) - now I just hit Alt-Shift-T on a class and it takes me to the corresponding test, or offers to create one in the absence of an existing test.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2006/12/29/eclipse-vs-intellij-final-showdown/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Self-deleting script accident</title>
		<link>http://squadlimber.com/chris/2006/12/16/self-deleting-script-accident/</link>
		<comments>http://squadlimber.com/chris/2006/12/16/self-deleting-script-accident/#comments</comments>
		<pubDate>Sat, 16 Dec 2006 20:35:13 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Tools n Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/?p=10</guid>
		<description><![CDATA[I was working on a build which kept generating loads of files but not cleaning them afterwards.  This was causing tests to fail because of stuff hanging around between builds.
So, I wrote a script which deletes files that are local and not in the Subversion repository.
#!/bin/bash

echo Deleting all local files not in Subversion repository:
echo
svn [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a build which kept generating loads of files but not cleaning them afterwards.  This was causing tests to fail because of stuff hanging around between builds.<br />
So, I wrote a script which deletes files that are local and not in the Subversion repository.</p>
<pre>#!/bin/bash

echo Deleting all local files not in Subversion repository:
echo
svn st | grep ? | awk '{ print "deleting... " $2; }'
echo
svn st | grep ? | awk '{print $2; }' | xargs rm -rf
echo Remaining differences to repository:
echo
svn st</pre>
<p>Only problem was, because the script was not added to Subversion - it deleted itself.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2006/12/16/self-deleting-script-accident/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
