<?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"
	>
<channel>
	<title>Comments for drboblog</title>
	<atom:link href="http://tecnocode.co.uk/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://tecnocode.co.uk</link>
	<description>Ramblings on computers…</description>
	<pubDate>Fri, 21 Nov 2008 07:01:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>Comment on String swap algorithms by Jonathan Turner</title>
		<link>http://tecnocode.co.uk/2008/11/19/string-swap-algorithms/#comment-473</link>
		<dc:creator>Jonathan Turner</dc:creator>
		<pubDate>Thu, 20 Nov 2008 22:12:44 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=171#comment-473</guid>
		<description>Thanks for the puzzler.  Always a good exercise to bang a problem like that around: it's easy to wrap your head around but there's still enough subtlety there to make it interesting.

After some looking, my cousin pointed out that stl::rotate uses your #2 solution.  After a minute of thought, it's pretty obvious why. 

Solution #1 and #3 use swaps, and regardless of how efficient a swap is, I'm pretty sure you always read three times (once for each slot, and once for the temp) and write three times (same).  Solution #2 does not swap, but instead reads once and writes once per transfer.  Even at O(n) (or n+2) ops, the number of operations is less than O(n/2) swaps.</description>
		<content:encoded><![CDATA[<p>Thanks for the puzzler.  Always a good exercise to bang a problem like that around: it&#8217;s easy to wrap your head around but there&#8217;s still enough subtlety there to make it interesting.</p>
<p>After some looking, my cousin pointed out that stl::rotate uses your #2 solution.  After a minute of thought, it&#8217;s pretty obvious why. </p>
<p>Solution #1 and #3 use swaps, and regardless of how efficient a swap is, I&#8217;m pretty sure you always read three times (once for each slot, and once for the temp) and write three times (same).  Solution #2 does not swap, but instead reads once and writes once per transfer.  Even at O(n) (or n+2) ops, the number of operations is less than O(n/2) swaps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on String swap algorithms by Benjamin Otte</title>
		<link>http://tecnocode.co.uk/2008/11/19/string-swap-algorithms/#comment-470</link>
		<dc:creator>Benjamin Otte</dc:creator>
		<pubDate>Thu, 20 Nov 2008 12:40:39 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=171#comment-470</guid>
		<description>You can improve on Method 2 by not keeping an extra character, but using the empty space as the "extra character". If you do this, the approach is of equal complexity, but simpler to implement:
given 3 variables:
length = length (str)
lcd = LCD(length (substr1), length);
for (i =0; i &#60; lcd; i++):
.. j = i
.. k = (j + l1) mod length
.. while k != i:
.... swap_chars (j, k)
.... j = k
.... k = (j + l1) mod length

That should give you at least equal performance than method 3 without doing anything fancy. It should also take the minimum amount of swaps necessary. Examples:
foobar
boofar - 1 swap
baofor - 1 swap
barfoo - 1 swap
123456foo
f231564oo - 2 swaps
fo312645o - 2 swaps
foo123456 - 2 swaps</description>
		<content:encoded><![CDATA[<p>You can improve on Method 2 by not keeping an extra character, but using the empty space as the &#8220;extra character&#8221;. If you do this, the approach is of equal complexity, but simpler to implement:<br />
given 3 variables:<br />
length = length (str)<br />
lcd = LCD(length (substr1), length);<br />
for (i =0; i &lt; lcd; i++):<br />
.. j = i<br />
.. k = (j + l1) mod length<br />
.. while k != i:<br />
&#8230;. swap_chars (j, k)<br />
&#8230;. j = k<br />
&#8230;. k = (j + l1) mod length</p>
<p>That should give you at least equal performance than method 3 without doing anything fancy. It should also take the minimum amount of swaps necessary. Examples:<br />
foobar<br />
boofar - 1 swap<br />
baofor - 1 swap<br />
barfoo - 1 swap<br />
123456foo<br />
f231564oo - 2 swaps<br />
fo312645o - 2 swaps<br />
foo123456 - 2 swaps</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on String swap algorithms by Marius Gedminas</title>
		<link>http://tecnocode.co.uk/2008/11/19/string-swap-algorithms/#comment-469</link>
		<dc:creator>Marius Gedminas</dc:creator>
		<pubDate>Thu, 20 Nov 2008 12:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=171#comment-469</guid>
		<description>Jon Bentley's _Programming Pearls_ also discusses this problem (called 'vector rotation' in the book), with graphs of actual running times of the three algorithms.</description>
		<content:encoded><![CDATA[<p>Jon Bentley&#8217;s _Programming Pearls_ also discusses this problem (called &#8216;vector rotation&#8217; in the book), with graphs of actual running times of the three algorithms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on String swap algorithms by Patrys</title>
		<link>http://tecnocode.co.uk/2008/11/19/string-swap-algorithms/#comment-467</link>
		<dc:creator>Patrys</dc:creator>
		<pubDate>Thu, 20 Nov 2008 11:28:15 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=171#comment-467</guid>
		<description>Also, I think it's really a problem of assigning proper weights to each letter and choosing the most efficient in-place sorting algorithm (be it letter- or block-based).</description>
		<content:encoded><![CDATA[<p>Also, I think it&#8217;s really a problem of assigning proper weights to each letter and choosing the most efficient in-place sorting algorithm (be it letter- or block-based).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on String swap algorithms by Patrys</title>
		<link>http://tecnocode.co.uk/2008/11/19/string-swap-algorithms/#comment-462</link>
		<dc:creator>Patrys</dc:creator>
		<pubDate>Wed, 19 Nov 2008 23:46:24 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=171#comment-462</guid>
		<description>I seriously don't think you can consider swapping two strings of equal length an atomic operation.

If you do, then the single letter swapping method does not need a placeholder step, you just swap the i-th character with any of the remaining [i+1..n] characters if needed. This makes it ~(n - 1) at most (i-th step guarantees i characters in place but there's nothing to swap the n-th character with).</description>
		<content:encoded><![CDATA[<p>I seriously don&#8217;t think you can consider swapping two strings of equal length an atomic operation.</p>
<p>If you do, then the single letter swapping method does not need a placeholder step, you just swap the i-th character with any of the remaining [i+1..n] characters if needed. This makes it ~(n - 1) at most (i-th step guarantees i characters in place but there&#8217;s nothing to swap the n-th character with).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Almanah 0.5.0 by Neil Williams</title>
		<link>http://tecnocode.co.uk/2008/11/16/almanah-050/#comment-448</link>
		<dc:creator>Neil Williams</dc:creator>
		<pubDate>Mon, 17 Nov 2008 00:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=163#comment-448</guid>
		<description>That pc.in file in SVN is misleading - it is for 2.24 branch support, there is no pkg-config for libcryptui.so in the released seahorse 2.22 (either Debian or Ubuntu Intrepid). Debian is now frozen but seahorse 2.24 is not in experimental either. So, to answer my own question, yes, almanah must require seahorse &#62;= 2.24 to build, as well as the Gtk+ version bump. libcryptui0 does not exist outside Ubuntu Jaunty - and Debian is currently frozen.</description>
		<content:encoded><![CDATA[<p>That pc.in file in SVN is misleading - it is for 2.24 branch support, there is no pkg-config for libcryptui.so in the released seahorse 2.22 (either Debian or Ubuntu Intrepid). Debian is now frozen but seahorse 2.24 is not in experimental either. So, to answer my own question, yes, almanah must require seahorse &gt;= 2.24 to build, as well as the Gtk+ version bump. libcryptui0 does not exist outside Ubuntu Jaunty - and Debian is currently frozen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Almanah 0.5.0 by Philip Withnall</title>
		<link>http://tecnocode.co.uk/2008/11/16/almanah-050/#comment-447</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Sun, 16 Nov 2008 23:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=163#comment-447</guid>
		<description>On Ubuntu at least, there is a libcryptui0 package. libcryptui is part of the Seahorse SVN, and even in the 2.22 branch there is a pkgconfig file in SVN: http://svn.gnome.org/viewvc/seahorse/branches/gnome-2-22/libcryptui/

Are you sure you've got the appropriate seahorse package installed (perhaps libcryptui0, if you're on Ubuntu or Debian)?

There's no mention of cryptui in version 0.4's configure.ac because the key selection combobox (provided by libcryptui) is new to version 0.5.</description>
		<content:encoded><![CDATA[<p>On Ubuntu at least, there is a libcryptui0 package. libcryptui is part of the Seahorse SVN, and even in the 2.22 branch there is a pkgconfig file in SVN: <a href="http://svn.gnome.org/viewvc/seahorse/branches/gnome-2-22/libcryptui/" rel="nofollow">http://svn.gnome.org/viewvc/seahorse/branches/gnome-2-22/libcryptui/</a></p>
<p>Are you sure you&#8217;ve got the appropriate seahorse package installed (perhaps libcryptui0, if you&#8217;re on Ubuntu or Debian)?</p>
<p>There&#8217;s no mention of cryptui in version 0.4&#8217;s configure.ac because the key selection combobox (provided by libcryptui) is new to version 0.5.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Almanah 0.5.0 by Neil Williams</title>
		<link>http://tecnocode.co.uk/2008/11/16/almanah-050/#comment-445</link>
		<dc:creator>Neil Williams</dc:creator>
		<pubDate>Sun, 16 Nov 2008 22:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=163#comment-445</guid>
		<description>In which case, something is wrong with the check because I use seahorse but the build for 0.5 still failed, looking for cryptui via pkg-config. seahorse 2.22.3-2 does not provide any pkg-config data - does the prog need a later version?
checking for ENCRYPTION... configure: error: Package requirements (cryptui-0.0).
There's no mention of cryptui in the configure.ac of v0.4. (Feel free to file a bug in seahorse - and gpgme - upstreams asking for pkg-config support!) :-)</description>
		<content:encoded><![CDATA[<p>In which case, something is wrong with the check because I use seahorse but the build for 0.5 still failed, looking for cryptui via pkg-config. seahorse 2.22.3-2 does not provide any pkg-config data - does the prog need a later version?<br />
checking for ENCRYPTION&#8230; configure: error: Package requirements (cryptui-0.0).<br />
There&#8217;s no mention of cryptui in the configure.ac of v0.4. (Feel free to file a bug in seahorse - and gpgme - upstreams asking for pkg-config support!) <img src='http://tecnocode.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Almanah 0.5.0 by Philip Withnall</title>
		<link>http://tecnocode.co.uk/2008/11/16/almanah-050/#comment-443</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Sun, 16 Nov 2008 18:52:04 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=163#comment-443</guid>
		<description>There aren't "two methods of encryption". libcryptui is (as its name suggests) used for encryption widgets (specifically, the encryption key selector), while gpgme is used for the encryption process itself. Both are required if encryption is to be enabled.
libcryptui is provided by Seahorse.</description>
		<content:encoded><![CDATA[<p>There aren&#8217;t &#8220;two methods of encryption&#8221;. libcryptui is (as its name suggests) used for encryption widgets (specifically, the encryption key selector), while gpgme is used for the encryption process itself. Both are required if encryption is to be enabled.<br />
libcryptui is provided by Seahorse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Almanah 0.5.0 by Philip Withnall</title>
		<link>http://tecnocode.co.uk/2008/11/16/almanah-050/#comment-442</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Sun, 16 Nov 2008 18:50:18 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=163#comment-442</guid>
		<description>I've changed the links in the post to be more intuitive.

I've no idea why those files are executable, but I'll fix that in trunk, thanks.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve changed the links in the post to be more intuitive.</p>
<p>I&#8217;ve no idea why those files are executable, but I&#8217;ll fix that in trunk, thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
