<?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>Dark Views &#187; Tricks</title>
	<atom:link href="http://blog.pdark.de/tag/tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pdark.de</link>
	<description>Opinions and views about computers, writing SciFi and everything else.</description>
	<lastBuildDate>Wed, 08 Feb 2012 06:43:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.pdark.de' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/7741f06d762e6a53700b2915f21e3d77?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Dark Views &#187; Tricks</title>
		<link>http://blog.pdark.de</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.pdark.de/osd.xml" title="Dark Views" />
	<atom:link rel='hub' href='http://blog.pdark.de/?pushpress=hub'/>
		<item>
		<title>Verifying Results in Tests</title>
		<link>http://blog.pdark.de/2009/03/05/verifying-results-in-tests/</link>
		<comments>http://blog.pdark.de/2009/03/05/verifying-results-in-tests/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 10:46:55 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tipps]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=557</guid>
		<description><![CDATA[So you finally got yourself writing a test against a database. In the test, you have to verify that a row in the table is correct, so you write: and it sucks. Yeah, junit will notify you when something in that row is wrong and if you have a cool IDE, you can even compare [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=557&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So you finally got yourself writing a test against a database. In the test, you have to verify that a row in the table is correct, so you write:</p>
<p><pre class="brush: java;">
assertEquals (
    &quot;2008-09-16-13.50.18.000000;;;;1;2008-08-07;2008-08-07;JUNIT;2008-09-16;t0001;001;;Doe;Jane;;Street;2;Doe Jane;;;;;X;2575;John;;;;US;E;;01;;;;125;01425;0;Shop;;;DOE;JANE;JOHN;032;1;;0001010301;;;;&quot;,
    dumpRow(key));
</pre></p>
<p>and it sucks. Yeah, junit will notify you when something in that row is wrong and if you have a cool IDE, you can even compare the fields &#8230; but it still sucks. If one of the fields in the middle change, you have to scroll and eyeball-diff, wasting your time. The solution is pretty simple:</p>
<p><pre class="brush: java;">
assertEquals (
    &quot;2008-09-16-13.50.18.000000\n&quot;
    + &quot;\n&quot;
    + &quot;\n&quot;
    + &quot;\n&quot;
    + &quot;1\n&quot;
    + &quot;2008-08-07\n&quot;
    + &quot;2008-08-07\n&quot;
    + &quot;JUNIT\n&quot;
    + &quot;2008-09-16\n&quot;
...
    dumpRow(key).replaceAll(&quot;;&quot;, &quot;\n&quot;);
</pre></p>
<p>Instead of dumping the data in a single long string, split it into lines so you can compare fields side by side and without scrolling sideways.</p>
<br /> Tagged: TDD, Testing, Tipps, Tricks <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/557/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=557&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/03/05/verifying-results-in-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Tricks: Commenting Out Code</title>
		<link>http://blog.pdark.de/2009/02/25/java-tricks-commenting-out-code/</link>
		<comments>http://blog.pdark.de/2009/02/25/java-tricks-commenting-out-code/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 09:05:48 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tipps]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://darkviews.wordpress.com/?p=538</guid>
		<description><![CDATA[How do you comment out code? Using /*...*/? Using your IDE to put // before each line? There is a third method: Pros: Nests You need only change a single character to &#8220;flip&#8221; the comment: Replace the 0 with 1. You won&#8217;t get warnings because of suddenly unused imports or local variables. The Java compiler [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=538&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How do you comment out code? Using <code>/*...*/</code>? Using your IDE to put <code>//</code> before each line? There is a third method:</p>
<p><pre class="brush: java;">
    if (0 == 1) {
        ... code ...
    }
</pre></p>
<p>Pros:</p>
<ul>
<li>Nests</li>
<li>You need only change a single character to &#8220;flip&#8221; the comment: Replace the 0 with 1.</li>
<li>You won&#8217;t get warnings because of suddenly unused imports or local variables.</li>
<li>The Java compiler will remove this block of code in the optimization step, so no runtime penality.</li>
</ul>
<p>Cons:</p>
<ul>
<li>Can only be used inside of methods.</li>
</ul>
<p>If you need a fast way to repeatedly comment in/out a piece of code elsewhere, use this syntax:</p>
<p><pre class="brush: java;">
    //* Fast flip comment starts here
        ... code ...
    /* and ends here */
</pre></p>
<p>Inside of a <code>/*...*/</code> comment, the sequence &#8220;/*&#8221; has no special meaning. To comment out the block of code, remove the first &#8220;/&#8221; in &#8220;//*&#8221;:</p>
<p><pre class="brush: java;">
    /* Fast flip comment starts here
        ... code ...
    /* and ends here */
</pre></p>
<br /> Tagged: Java, Tipps, Tricks <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/538/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=538&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/02/25/java-tricks-commenting-out-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Tricks: Fastest Way to Collecting Objects in a String</title>
		<link>http://blog.pdark.de/2008/07/11/fastest-way-to-collecting-objects-in-a-string/</link>
		<comments>http://blog.pdark.de/2008/07/11/fastest-way-to-collecting-objects-in-a-string/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 18:08:00 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tipps]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://darkviews.wordpress.com/2008/07/11/fastest-way-to-collecting-objects-in-a-string/</guid>
		<description><![CDATA[The fastest way to collect a list of objects in a String in Java:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=122&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The fastest way to collect a list of objects in a String in Java:</p>
<p><pre class="brush: java;">
StringBuilder buffer = new StringBuilder ();
String delim = &quot;&quot;;
for (Object o: list)
{
    buffer.append (delim);
    delim = &quot;, &quot;; // Avoid if(); assignment is very fast!
    buffer.append (o);
}
buffer.toString ();
</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/darkviews.wordpress.com/122/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/darkviews.wordpress.com/122/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=122&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2008/07/11/fastest-way-to-collecting-objects-in-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
	</channel>
</rss>
