<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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: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>Comments for dantwining.com</title>
	<atom:link href="http://dantwining.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://dantwining.com</link>
	<description>every day is a school day</description>
	<lastBuildDate>Thu, 11 Mar 2010 21:03:13 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on GWT, OpenLayers and Full Screen Maps &#8211; Solved! by dantwining</title>
		<link>http://dantwining.com/2010/03/01/gwt-openlayers-and-full-screen-maps/#comment-184</link>
		<dc:creator>dantwining</dc:creator>
		<pubDate>Thu, 11 Mar 2010 21:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=768#comment-184</guid>
		<description>One slight footnote; the current version of GWT-OpenLayers that I have doesn&#039;t have the updateMap() layers - my fix actually only works in conjunction with a test jar that the guys developing GWT-OpenLayers sent me. You can find that jar in my googlecode repo, or with any luck the whole fix will be rolled into the net version of GWT-OL.</description>
		<content:encoded><![CDATA[<p>One slight footnote; the current version of GWT-OpenLayers that I have doesn&#8217;t have the updateMap() layers &#8211; my fix actually only works in conjunction with a test jar that the guys developing GWT-OpenLayers sent me. You can find that jar in my googlecode repo, or with any luck the whole fix will be rolled into the net version of GWT-OL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Twitter IDs for comments by dantwining</title>
		<link>http://dantwining.com/2010/01/30/using-twitter-ids-for-comments/#comment-180</link>
		<dc:creator>dantwining</dc:creator>
		<pubDate>Mon, 01 Mar 2010 10:26:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.dantwining.com/?p=471#comment-180</guid>
		<description>Another vote for the delegation of password provision...

http://www.guardian.co.uk/commentisfree/2010/feb/27/charlie-brooker-forgotten-your-password</description>
		<content:encoded><![CDATA[<p>Another vote for the delegation of password provision&#8230;</p>
<p><a href="http://www.guardian.co.uk/commentisfree/2010/feb/27/charlie-brooker-forgotten-your-password" rel="nofollow">http://www.guardian.co.uk/commentisfree/2010/feb/27/charlie-brooker-forgotten-your-password</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Separate Content and Control by dantwining</title>
		<link>http://dantwining.com/2009/09/25/separate-content-and-control/#comment-177</link>
		<dc:creator>dantwining</dc:creator>
		<pubDate>Sun, 21 Feb 2010 19:28:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.dantwining.com/?p=503#comment-177</guid>
		<description>Good work Burns. Although of course it&#039;s even worse than that; the pirate doesn&#039;t even have to bother to go out and buy the movie, s/he can just download the bits and do away with the delay and constraint of having to buy it in a shop... not to mention all the ridiculous, redundant waste in manufacturing and transporting a plastic disc all the way from China to my DVD player just to end up in landfill.

So, there you go. Saving the planet, one BitTorrent at a time.</description>
		<content:encoded><![CDATA[<p>Good work Burns. Although of course it&#8217;s even worse than that; the pirate doesn&#8217;t even have to bother to go out and buy the movie, s/he can just download the bits and do away with the delay and constraint of having to buy it in a shop&#8230; not to mention all the ridiculous, redundant waste in manufacturing and transporting a plastic disc all the way from China to my DVD player just to end up in landfill.</p>
<p>So, there you go. Saving the planet, one BitTorrent at a time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Separate Content and Control by matt burns</title>
		<link>http://dantwining.com/2009/09/25/separate-content-and-control/#comment-176</link>
		<dc:creator>matt burns</dc:creator>
		<pubDate>Sun, 21 Feb 2010 19:07:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.dantwining.com/?p=503#comment-176</guid>
		<description>http://i.imgur.com/GxzeV.jpg</description>
		<content:encoded><![CDATA[<p><a href="http://i.imgur.com/GxzeV.jpg" rel="nofollow">http://i.imgur.com/GxzeV.jpg</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Every day is a school day, but sometimes you&#8217;ve moved down a class. by matt burns</title>
		<link>http://dantwining.com/2010/02/17/every-day-is-a-school-day-but-sometimes-youve-moved-down-a-class/#comment-174</link>
		<dc:creator>matt burns</dc:creator>
		<pubDate>Thu, 18 Feb 2010 13:10:25 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=752#comment-174</guid>
		<description>Yeah, the size of an array is fixed forever and can&#039;t be changed (that&#039;s why we use Lists instead).

The client could use the contents of your method if he wanted to swap the references but you can&#039;t do that in a method. That&#039;s because the method was passed a copy of the reference the client has. All you can do is change the state of object that reference points to, you can&#039;t change where his reference points.</description>
		<content:encoded><![CDATA[<p>Yeah, the size of an array is fixed forever and can&#8217;t be changed (that&#8217;s why we use Lists instead).</p>
<p>The client could use the contents of your method if he wanted to swap the references but you can&#8217;t do that in a method. That&#8217;s because the method was passed a copy of the reference the client has. All you can do is change the state of object that reference points to, you can&#8217;t change where his reference points.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Every day is a school day, but sometimes you&#8217;ve moved down a class. by dantwining</title>
		<link>http://dantwining.com/2010/02/17/every-day-is-a-school-day-but-sometimes-youve-moved-down-a-class/#comment-173</link>
		<dc:creator>dantwining</dc:creator>
		<pubDate>Thu, 18 Feb 2010 12:01:38 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=752#comment-173</guid>
		<description>So what (I assume that) you&#039;re saying (like I bother to read all of your comments), among other things, is it isn&#039;t possible for swapArrays to swap array of different length. Which makes sense to me. But then my first answer made sense to me...</description>
		<content:encoded><![CDATA[<p>So what (I assume that) you&#8217;re saying (like I bother to read all of your comments), among other things, is it isn&#8217;t possible for swapArrays to swap array of different length. Which makes sense to me. But then my first answer made sense to me&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Every day is a school day, but sometimes you&#8217;ve moved down a class. by matt burns</title>
		<link>http://dantwining.com/2010/02/17/every-day-is-a-school-day-but-sometimes-youve-moved-down-a-class/#comment-172</link>
		<dc:creator>matt burns</dc:creator>
		<pubDate>Thu, 18 Feb 2010 12:00:34 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=752#comment-172</guid>
		<description>It&#039;s all horrible and makes me feel sick and dirty. Where&#039;s my lovely objects?

Set the next puzzle on something nice and OOey.</description>
		<content:encoded><![CDATA[<p>It&#8217;s all horrible and makes me feel sick and dirty. Where&#8217;s my lovely objects?</p>
<p>Set the next puzzle on something nice and OOey.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Every day is a school day, but sometimes you&#8217;ve moved down a class. by matt burns</title>
		<link>http://dantwining.com/2010/02/17/every-day-is-a-school-day-but-sometimes-youve-moved-down-a-class/#comment-171</link>
		<dc:creator>matt burns</dc:creator>
		<pubDate>Thu, 18 Feb 2010 11:59:01 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=752#comment-171</guid>
		<description>Oh, here&#039;s a version that would truncate or pad with zeroes rather than throw an exception if there was an array length mismatch:
&lt;pre&gt;
     @Test
    public void testMismatchedArraySizes() {
        byte[] uno = new byte[] { 1, 1 };
        byte[] due = new byte[] { 2 };

        swapArraysPadAndTrunc(uno, due);

        Assert.assertArrayEquals(new byte[] { 2, 0 }, uno);
        Assert.assertArrayEquals(new byte[] { 1 }, due);
    }

    void swapArraysPadAndTrunc(byte[] a1, byte[] a2) {
        byte[] left = Arrays.copyOf(a1, a2.length);
        byte[] right = Arrays.copyOf(a2, a1.length);
        System.arraycopy(right, 0, a1, 0, right.length);
        System.arraycopy(left, 0, a2, 0, left.length);
    }
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Oh, here&#8217;s a version that would truncate or pad with zeroes rather than throw an exception if there was an array length mismatch:</p>
<pre>
     @Test
    public void testMismatchedArraySizes() {
        byte[] uno = new byte[] { 1, 1 };
        byte[] due = new byte[] { 2 };

        swapArraysPadAndTrunc(uno, due);

        Assert.assertArrayEquals(new byte[] { 2, 0 }, uno);
        Assert.assertArrayEquals(new byte[] { 1 }, due);
    }

    void swapArraysPadAndTrunc(byte[] a1, byte[] a2) {
        byte[] left = Arrays.copyOf(a1, a2.length);
        byte[] right = Arrays.copyOf(a2, a1.length);
        System.arraycopy(right, 0, a1, 0, right.length);
        System.arraycopy(left, 0, a2, 0, left.length);
    }
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Every day is a school day, but sometimes you&#8217;ve moved down a class. by matt burns</title>
		<link>http://dantwining.com/2010/02/17/every-day-is-a-school-day-but-sometimes-youve-moved-down-a-class/#comment-170</link>
		<dc:creator>matt burns</dc:creator>
		<pubDate>Thu, 18 Feb 2010 11:46:35 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=752#comment-170</guid>
		<description>Here&#039;s an implementation of your first attempt that works:
&lt;pre&gt;
    void swapArrays(byte[] a1, byte[] a2) {
        byte[] temp = java.util.Arrays.copyOf(a1, a1.length);
        System.arraycopy(a2, 0, a1, 0, a2.length);
        System.arraycopy(temp, 0, a2, 0, temp.length);
    }
&lt;/pre&gt;

Although I find the following slightly more readable (but uses more memory I suppose):
&lt;pre&gt;
    void swapArrays2(byte[] a1, byte[] a2) {
        byte[] left = Arrays.copyOf(a1, a1.length);
        byte[] right = Arrays.copyOf(a2, a2.length);
        System.arraycopy(right, 0, a1, 0, right.length);
        System.arraycopy(left, 0, a2, 0, left.length);
    }
&lt;/pre&gt;

arraycopy will throw ArrayIndexOutOfBounds if there is a length mismatch.

I have no idea why arraycopy is in System. Horrible method anyway. I say horrible because it mutates the given objects rather than returning something (like the methods in java.util.Arrays). But hey, that was the spec of the desired method for this puzzle.

As you already pointed out, arrays and primitives suck. The real problem is that someone wanted this method. I&#039;d personally implement it using collections and force them to convert their arrays if they want to use it. (they could use Arrays.asList(T... a))

(As there&#039;s no preview function for commenters, I can only assume this will render as unreadable garbage. Well tough, I&#039;m not sorry about that, fix it.)</description>
		<content:encoded><![CDATA[<p>Here&#8217;s an implementation of your first attempt that works:</p>
<pre>
    void swapArrays(byte[] a1, byte[] a2) {
        byte[] temp = java.util.Arrays.copyOf(a1, a1.length);
        System.arraycopy(a2, 0, a1, 0, a2.length);
        System.arraycopy(temp, 0, a2, 0, temp.length);
    }
</pre>
<p>Although I find the following slightly more readable (but uses more memory I suppose):</p>
<pre>
    void swapArrays2(byte[] a1, byte[] a2) {
        byte[] left = Arrays.copyOf(a1, a1.length);
        byte[] right = Arrays.copyOf(a2, a2.length);
        System.arraycopy(right, 0, a1, 0, right.length);
        System.arraycopy(left, 0, a2, 0, left.length);
    }
</pre>
<p>arraycopy will throw ArrayIndexOutOfBounds if there is a length mismatch.</p>
<p>I have no idea why arraycopy is in System. Horrible method anyway. I say horrible because it mutates the given objects rather than returning something (like the methods in java.util.Arrays). But hey, that was the spec of the desired method for this puzzle.</p>
<p>As you already pointed out, arrays and primitives suck. The real problem is that someone wanted this method. I&#8217;d personally implement it using collections and force them to convert their arrays if they want to use it. (they could use Arrays.asList(T&#8230; a))</p>
<p>(As there&#8217;s no preview function for commenters, I can only assume this will render as unreadable garbage. Well tough, I&#8217;m not sorry about that, fix it.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on A short Java test, a long Java rant by Every day is a school day, but sometimes you&#8217;ve moved down a class. &#171; dantwining.com</title>
		<link>http://dantwining.com/2010/01/29/a-short-java-test-a-long-java-rant/#comment-169</link>
		<dc:creator>Every day is a school day, but sometimes you&#8217;ve moved down a class. &#171; dantwining.com</dc:creator>
		<pubDate>Wed, 17 Feb 2010 22:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://dantwining.com/?p=661#comment-169</guid>
		<description>[...] 17    by dantwining   Another day, another chance to be a complete computard. Following on from my previous Java test, a friend gave me a similar challenge. How would you implement the following [...]</description>
		<content:encoded><![CDATA[<p>[...] 17    by dantwining   Another day, another chance to be a complete computard. Following on from my previous Java test, a friend gave me a similar challenge. How would you implement the following [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
