<?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>Piotr Gabryanczyk's Blog</title>
	<atom:link href="http://piotrga.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://piotrga.wordpress.com</link>
	<description>Java, Refactoring, AOP, Spring, DDD, TDD, etc.</description>
	<lastBuildDate>Fri, 13 Jan 2012 11:24:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='piotrga.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Piotr Gabryanczyk's Blog</title>
		<link>http://piotrga.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://piotrga.wordpress.com/osd.xml" title="Piotr Gabryanczyk&#039;s Blog" />
	<atom:link rel='hub' href='http://piotrga.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Learn Russian with russian-lessons.co.uk</title>
		<link>http://piotrga.wordpress.com/2011/05/08/learn-russian-with-russian-lessons-co-uk/</link>
		<comments>http://piotrga.wordpress.com/2011/05/08/learn-russian-with-russian-lessons-co-uk/#comments</comments>
		<pubDate>Sun, 08 May 2011 21:20:40 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[learn russian]]></category>
		<category><![CDATA[learn russian in london]]></category>
		<category><![CDATA[learning russian]]></category>
		<category><![CDATA[russian courses in london]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=152</guid>
		<description><![CDATA[I just finished my new project http://www.russian-lessons.co.uk. It took me 2 days and it&#8217;s been done entirely with html 5. If you want to learn Russian in London check it out!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=152&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just finished my new project http://www.russian-lessons.co.uk.<br />
It took me 2 days and it&#8217;s been done entirely with html 5.</p>
<p>If you want to learn Russian in London check it out!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=152&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2011/05/08/learn-russian-with-russian-lessons-co-uk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>Converting Maven pom.xml to SBT</title>
		<link>http://piotrga.wordpress.com/2010/11/14/converting-maven-pom-xml-to-sbt/</link>
		<comments>http://piotrga.wordpress.com/2010/11/14/converting-maven-pom-xml-to-sbt/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 13:19:47 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[pom]]></category>
		<category><![CDATA[sbt]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=145</guid>
		<description><![CDATA[Add this task to your project class. Run reload, then pom2sbt. Copy the output to the project file and enjoy! lazy val pom2sbt = task { val deps = XML.load("pom.xml") \\ "dependencies" deps \"dependency" foreach( (dependency:Node) =&#62; { val groupId = (dependency \ "groupId").text val artifactId = (dependency \ "artifactId").text val version = (dependency \ [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=145&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Add this task to your project class.<br />
Run reload, then pom2sbt.<br />
Copy the output to the project file and enjoy!</p>
<pre>
<code>
lazy val pom2sbt = task {
    val deps = XML.load("pom.xml") \\ "dependencies"
    deps \"dependency" foreach( (dependency:Node) =&gt; {
      val groupId = (dependency \ "groupId").text
      val artifactId = (dependency \ "artifactId").text
      val version = (dependency \ "version").text
      val scope = (dependency \ "scope").text
      val classifier = (dependency \ "classifier").text
      val artifactValName: String = artifactId.replaceAll("[-\\.]", "_")

      print("val %s = \"%s\" %% \"%s\" %% \"%s\"".format(artifactValName, groupId, artifactId, version))
      scope match  {
        case "" =&gt; print("\n")
        case _ =&gt; print(" %% \"%s\"\n".format(scope))
      }
      None
    } )
    None
  }
</code>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=145&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2010/11/14/converting-maven-pom-xml-to-sbt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>How to resolve java dependency from the command line without maven</title>
		<link>http://piotrga.wordpress.com/2010/09/26/how-to-resolve-java-dependency-from-the-command-line-without-maven/</link>
		<comments>http://piotrga.wordpress.com/2010/09/26/how-to-resolve-java-dependency-from-the-command-line-without-maven/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 14:09:51 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=135</guid>
		<description><![CDATA[Problem I want to be able to download java library and it&#8217;s dependencies using simple command-line tool i.e. ivy.sh resolve jetty jetty 5.1.10 Solution Download Ivy. Ivy understands maven repositories and can do the job for you. Create a script ivy.sh in ivy installation directory with the following content: cd=`dirname $0` if [ "$1" == [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=135&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>I want to be able to download java library and it&#8217;s dependencies using simple command-line tool i.e.<br />
<code>ivy.sh resolve jetty jetty 5.1.10</code></p>
<h2>Solution</h2>
<ul>
<li>Download Ivy. Ivy understands maven repositories and can do the job for you.</li>
<li>Create a script ivy.sh in ivy installation directory with the following content:
<p><code>
<pre>cd=`dirname $0`
if [ "$1" == "resolve" ]; then
        shift
        echo "Resolving $1 $2 $3"
        java -jar $cd/ivy-2.2.0-rc1.jar -retrieve ./[artifact]-[revision]-[type].[ext] -dependency $*
fi</pre>
<p></code></li>
<li>Make your script executable:<br />
<code>chmod a+x ivy.sh</code></li>
<li>Add it to the path ie. ~/.bash_profile<br />
<code>export PATH=$PATH:/where/you/have/ivy.sh<br />
</code></li>
</ul>
<p><strong>Enjoy!</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=135&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2010/09/26/how-to-resolve-java-dependency-from-the-command-line-without-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>Gradle Cobertura Integration Revisited</title>
		<link>http://piotrga.wordpress.com/2010/04/17/gradle-cobertura-integration-revisited/</link>
		<comments>http://piotrga.wordpress.com/2010/04/17/gradle-cobertura-integration-revisited/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 12:37:49 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cobertura]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=108</guid>
		<description><![CDATA[Problem I&#8217;d like to run cobertura coverage report using gradle in a non intrusive way similar to maven. I just want to do this: gradle cobertura and in my script: apply from: 'cobertura.gradle' Current solution There is a great solution to this problem here. It works, but is not as unintrusive and not as easy [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=108&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>I&#8217;d like to run cobertura coverage report using gradle in a non intrusive way similar to maven.<br />
I just want to do this:<br />
<code>
<div style="background:#F7F7F7!important;color:black;font-family:'Andale Mono', 'Lucida Console', Monaco, Liberation, fixed, monospace;font-size:11px;border:1px solid #CCC;padding:6px;">gradle cobertura</div>
<p></code><br />
and in my script:<br />
<code>
<div style="background:#F7F7F7!important;color:black;font-family:'Andale Mono', 'Lucida Console', Monaco, Liberation, fixed, monospace;font-size:11px;border:1px solid #CCC;padding:6px;">apply from: 'cobertura.gradle'</div>
<p></code></p>
<h2>Current solution</h2>
<p>There is a great solution to this problem <a href="http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-usingCobertura">here</a>. It works, but is not as unintrusive and not as easy to use as I would like it to be.</p>
<h2>My solution</h2>
<p>This works for Gradle version 0.9-preview-1.</p>
<p><b>cobertura.gradle:</b><br />
<code>
<div style="background:#F7F7F7!important;color:black;font-family:'Andale Mono', 'Lucida Console', Monaco, Liberation, fixed, monospace;font-size:11px;border:1px solid #CCC;padding:6px;">
<pre>
logger.info "Configuring Cobertura Plugin"

configurations{
  coberturaRuntime {extendsFrom testRuntime}
}

dependencies {
  coberturaRuntime 'net.sourceforge.cobertura:cobertura:1.9.3'
}

def serFile="${project.buildDir}/cobertura.ser"
def classes="${project.sourceSets.main.classesDir}"
def classesCopy="${classes}-copy"

task cobertura(type: Test){
  dependencies {
    testRuntime 'net.sourceforge.cobertura:cobertura:1.9.3'
  }  

  systemProperties["net.sourceforge.cobertura.datafile"] = serFile
}

cobertura.doFirst  {
  logger.quiet "Instrumenting classes for Cobertura"
  ant {
    delete(file:serFile, failonerror:false)
    delete(dir: classesCopy, failonerror:false)
    copy(todir: classesCopy) { fileset(dir: classes) }

    taskdef(resource:'tasks.properties', classpath: configurations.coberturaRuntime.asPath)
    'cobertura-instrument'(datafile: serFile) {
      fileset(dir: classes,
              includes:"**/*.class",
              excludes:"**/*Test.class")
    }
  }
}

cobertura.doLast{
  if (new File(classesCopy).exists()) {
    ant.'cobertura-report'(destdir:"${project.reportsDir}/cobertura",
            format:'html', srcdir:"src/main/java", datafile: serFile)

    ant.delete(file: classes)
    ant.move(file: classesCopy, tofile: classes)
  }
}
</pre>
</div>
<p></code><br />
And then your <b>build.gradle</b> could look like that:<br />
<code></p>
<div style="background:#F7F7F7!important;color:black;font-family:'Andale Mono', 'Lucida Console', Monaco, Liberation, fixed, monospace;font-size:11px;border:1px solid #CCC;padding:6px;">
apply plugin: 'java'<br />
apply from: 'cobertura.gradle'<br />
...
</div>
<p></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=108&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2010/04/17/gradle-cobertura-integration-revisited/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>How to run a system command in Erlang?</title>
		<link>http://piotrga.wordpress.com/2010/04/02/how-to-run-a-system-command-in-erlang/</link>
		<comments>http://piotrga.wordpress.com/2010/04/02/how-to-run-a-system-command-in-erlang/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 17:18:41 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=98</guid>
		<description><![CDATA[Problem I would like to be able to run ie. ls -al / from erlang and process the results using erlang. ie. Files = cmd:run("ls -al /"). Solution -module(cmd). -export([run/1, run/2, test/0]). run(Cmd) -&#62; run(Cmd, 5000). run(Cmd, Timeout) -&#62; Port = erlang:open_port({spawn, Cmd},[exit_status]), loop(Port,[], Timeout). loop(Port, Data, Timeout) -&#62; receive {Port, {data, NewData}} -&#62; loop(Port, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=98&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>I would like to be able to run ie. <code>ls -al /</code> from erlang and process the results using erlang. ie.<br />
<code><br />
Files = cmd:run("ls -al /").<br />
</code></p>
<h2>Solution</h2>
<p><code>
<pre>
-module(cmd).
-export([run/1, run/2, test/0]).

run(Cmd) -&gt;
	run(Cmd, 5000).

run(Cmd, Timeout) -&gt;
	Port = erlang:open_port({spawn, Cmd},[exit_status]),
	loop(Port,[], Timeout).

loop(Port, Data, Timeout) -&gt;
	receive
		{Port, {data, NewData}} -&gt; loop(Port, Data++NewData, Timeout);
		{Port, {exit_status, 0}} -&gt; Data;
		{Port, {exit_status, S}} -&gt; throw({commandfailed, S})
	after Timeout -&gt;
		throw(timeout)
	end.

test() -&gt;
	shouldReturnCommandResult(),
	shouldThrowAfterTimeout(),
	shouldThrowIfCmdFailed(),
	{ok, "Tests PASSED"}.

shouldReturnCommandResult() -&gt;
	"Hello\n" = run("echo Hello").

shouldThrowAfterTimeout()-&gt;
	timeout = (catch run("sleep 10", 20)).

shouldThrowIfCmdFailed()-&gt;
		{commandfailed, _} = (catch run("wrongcommand")),
		{commandfailed, _} = (catch run("ls nonexistingfile")).
</pre>
<p></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=98&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2010/04/02/how-to-run-a-system-command-in-erlang/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>How to download JavaDocs or sources in Maven 2?</title>
		<link>http://piotrga.wordpress.com/2009/06/25/how-to-download-javadocs-or-sources-in-maven-2/</link>
		<comments>http://piotrga.wordpress.com/2009/06/25/how-to-download-javadocs-or-sources-in-maven-2/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 10:53:43 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[maven maven2 javadoc javadocs sources]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=91</guid>
		<description><![CDATA[Problem You want to download javadocs for your depenencies into local repository to be able to use them ie. in IntelliJ. Solution mvn dependency:resolve -Dclassifier=javadoc mvn dependency:resolve -Dclassifier=sources Enjoy!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=91&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>You want to download javadocs for your depenencies into local repository to be able to use them ie. in IntelliJ.</p>
<h2>Solution</h2>
<p><code><br />
mvn dependency:resolve -Dclassifier=javadoc<br />
mvn dependency:resolve -Dclassifier=sources<br />
</code></p>
<p><strong>Enjoy!</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=91&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2009/06/25/how-to-download-javadocs-or-sources-in-maven-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>Howto compress or decompress byte array in Java?</title>
		<link>http://piotrga.wordpress.com/2009/06/08/howto-compress-or-decompress-byte-array-in-java/</link>
		<comments>http://piotrga.wordpress.com/2009/06/08/howto-compress-or-decompress-byte-array-in-java/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 13:54:39 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=86</guid>
		<description><![CDATA[Check this class out: Compressor.java import java.io.*; import java.util.zip.*; import org.apache.commons.io.IOUtils; public class Compressor{ public static byte[] compress(byte[] content){ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try{ GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream); gzipOutputStream.write(content); gzipOutputStream.close(); } catch(IOException e){ throw new RuntimeException(e); } System.out.printf("Compression ratio %f\n", (1.0f * content.length/byteArrayOutputStream.size())); return byteArrayOutputStream.toByteArray(); } public static byte[] decompress(byte[] contentBytes){ ByteArrayOutputStream out [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=86&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Check this class out:</strong></p>
<p>Compressor.java</p>
<pre>
import java.io.*;
import java.util.zip.*;

import org.apache.commons.io.IOUtils;

public class Compressor{
    public static byte[] compress(byte[] content){
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try{
            GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
            gzipOutputStream.write(content);
            gzipOutputStream.close();
        } catch(IOException e){
            throw new RuntimeException(e);
        }
        System.out.printf("Compression ratio %f\n", (1.0f * content.length/byteArrayOutputStream.size()));
        return byteArrayOutputStream.toByteArray();
    }

    public static byte[] decompress(byte[] contentBytes){
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try{
            IOUtils.copy(new GZIPInputStream(new ByteArrayInputStream(contentBytes)), out);
        } catch(IOException e){
            throw new RuntimeException(e);
        }
        return out.toByteArray();
    }

    public static boolean notWorthCompressing(String contentType){
        return contentType.contains("jpeg")
                || contentType.contains("pdf")
                || contentType.contains("zip")
                || contentType.contains("mpeg")
                || contentType.contains("avi");
    }
}
</pre>
<p><strong>Dependencies:</strong> Apache commons-io.jar</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=86&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2009/06/08/howto-compress-or-decompress-byte-array-in-java/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>Hamcrest Regex Matcher</title>
		<link>http://piotrga.wordpress.com/2009/03/27/hamcrest-regex-matcher/</link>
		<comments>http://piotrga.wordpress.com/2009/03/27/hamcrest-regex-matcher/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 11:32:53 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=79</guid>
		<description><![CDATA[Problem I could not find a regex matcher in hamcrest, to do ie. assertThat(selenium.getTitle(), matches("Template T\d{3}")); It could be that I was not looking well enough or Nat Pryce decided not to include it on purpose. Of&#8217;course I saw PatternMatcher, but it lets you build regexes rather then match against them. Solution So here you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=79&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>I could not find a regex matcher in hamcrest, to do ie.<br />
<code>assertThat(selenium.getTitle(), matches(<span style='color:red;'>"Template T\d{3}"</span>));</code></p>
<p>It could be that I was not looking well enough or <a href="http://www.natpryce.com/">Nat Pryce</a> decided not to include it on purpose. Of&#8217;course I saw <a href="http://code.google.com/p/hamcrest-text-patterns/">PatternMatcher</a>, but it lets you build regexes rather then match against them.</p>
<h2>Solution</h2>
<p>So here you have, enjoy!</p>
<pre>
<code>
public class RegexMatcher extends BaseMatcher{
    private final String regex;

    public RegexMatcher(String regex){
        this.regex = regex;
    }

    public boolean matches(Object o){
        return ((String)o).matches(regex);

    }

    public void describeTo(Description description){
        description.appendText("matches regex=");
    }

    public static RegexMatcher matches(String regex){
        return new RegexMatcher(regex);
    }
}
</code>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=79&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2009/03/27/hamcrest-regex-matcher/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>HowTo customize Save As/Open dialog shortcuts in XP using windows registry</title>
		<link>http://piotrga.wordpress.com/2009/02/18/howto-customize-save-asopen-dialog-shortcuts-in-xp-using-windows-registry/</link>
		<comments>http://piotrga.wordpress.com/2009/02/18/howto-customize-save-asopen-dialog-shortcuts-in-xp-using-windows-registry/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 11:15:06 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=71</guid>
		<description><![CDATA[Problem: I want to add custom shortcuts in Open/Save As dialog box in XP Manual Solution: Check this article by Ryan Gordon out if you want to do it manually. Automatic Solution: Create custom-save_as.reg file with content similar to the following: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Comdlg32] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Comdlg32\PlacesBar] "Place1"="e:\\piotrga" "Place2"="e:\\piotrga\\tmp" "Place3"="e:\\piotrga\\Download" Then right-click custom-save_as.reg and select "Merge" option. Now open [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=71&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem:</h2>
<p>I want to add custom shortcuts in Open/Save As dialog box in XP</p>
<h2>Manual Solution:</h2>
<p>Check <a href="http://www.insidetech.com/training/articles/3687-customize-opensave-as-dialog-boxes-in-windows-xp">this article by Ryan Gordon</a> out if you want to do it manually.</p>
<h2>Automatic Solution:</h2>
<p>Create <strong>custom-save_as.reg</strong> file with content similar to the following:</p>
<p><code>[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Comdlg32]</p>
<p>[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Comdlg32\PlacesBar]<br />
"Place1"="e:\\piotrga"<br />
"Place2"="e:\\piotrga\\tmp"<br />
"Place3"="e:\\piotrga\\Download"</p>
<p>Then right-click <strong>custom-save_as.reg</strong> and select "<strong>Merge</strong>" option.</p>
<p><b>Now open Save As/Open dialog and enjoy!</b></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=71&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2009/02/18/howto-customize-save-asopen-dialog-shortcuts-in-xp-using-windows-registry/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
		<item>
		<title>PortSpy in Ruby</title>
		<link>http://piotrga.wordpress.com/2008/10/22/portspy-in-ruby/</link>
		<comments>http://piotrga.wordpress.com/2008/10/22/portspy-in-ruby/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 10:05:28 +0000</pubDate>
		<dc:creator>Piotr Gabryanczyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[portspy]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://piotrga.wordpress.com/?p=63</guid>
		<description><![CDATA[To trace all the traffic between your browser and google run: ruby portspy.rb 80 www.google.com 80 And then point your browser to http://localhost:80 Enjoy! require "socket" STDOUT.sync = true STDERR.sync = true SERVER_PORT, REDIRECT_HOST, REDIRECT_PORT, *rest = ARGV puts "Forwarding from port #{SERVER_PORT} to #{REDIRECT_HOST}:#{REDIRECT_PORT}" server = TCPServer.new(SERVER_PORT) counter = 0 while( session = server.accept) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=63&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To trace all the traffic between your browser and google run:<br />
<code>ruby portspy.rb 80 www.google.com 80</code><br />
And then point your browser to<br />
<a href="http://localhost:80">http://localhost:80</a></p>
<p>Enjoy!</p>
<pre>
require "socket"
STDOUT.sync = true
STDERR.sync = true

SERVER_PORT, REDIRECT_HOST, REDIRECT_PORT, *rest = ARGV

puts "Forwarding from port #{SERVER_PORT} to #{REDIRECT_HOST}:#{REDIRECT_PORT}"

server = TCPServer.new(SERVER_PORT)

counter = 0
while( session = server.accept)
    counter += 1
    redirect = TCPSocket.new REDIRECT_HOST, REDIRECT_PORT
    puts "#{counter}&gt;OPENING CONNECTION"
    Thread.new(session, redirect, counter) do |s, r, c|
        begin
            req = File.new("data/request-#{c}.txt", "w")
            req.sync = true
            until( s.eof? )
                line = s.readpartial(128)
                puts "\n#{c}&gt;REQUEST:'#{Regexp.escape(line)}'"
                r.write line
                req.write line
                r.flush
            end
            s.close_read
            req.close
            r.close_write
            puts "\n#{c}&gt;CLOSING REQUEST SOCKET:"
        rescue =&gt; e
            puts "\n#{c}Error #{e}\n#{e.backtrace}"
            exit -1
        end
    end

    Thread.new(session, redirect, counter) do |s, r, c|
        begin
            resp = File.new("data/response-#{c}.txt", "w")
            resp.sync = true
            until( r.eof? )
                line = r.readpartial(128)
                puts "\n#{c}&gt;RESPONSE:'#{Regexp.escape(line)}'"
                resp.write line
                s.write line
                s.flush
            end
            puts "\n#{c}CLOSING RESPONSE"
            r.close_read
            resp.close
            s.close_write
        rescue =&gt;  e
            puts "\n#{c}Error #{e}\n#{e.backtrace.join "\n\t"}"
            exit -1
        end

    end
end
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/piotrga.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/piotrga.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/piotrga.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/piotrga.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/piotrga.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/piotrga.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/piotrga.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/piotrga.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=piotrga.wordpress.com&amp;blog=595023&amp;post=63&amp;subd=piotrga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://piotrga.wordpress.com/2008/10/22/portspy-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9b2bf89a10d0dfd765c2e95e8435bd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Piotr Gabryanczyk</media:title>
		</media:content>
	</item>
	</channel>
</rss>
