<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Running as Root</title>
	
	<link>http://www.runningasroot.com/blog</link>
	<description>My own observations, reviews, and stuff I'm working on.</description>
	<lastBuildDate>Wed, 28 Jul 2010 00:00:00 PDT</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RunningAsRoot" /><feedburner:info uri="runningasroot" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><image><link>http://creativecommons.org/licenses/by-nc-sa/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item><title>Links for 2010-07-27 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/mpAPhW9fKNc/wyscan</link><pubDate>Wed, 28 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-27</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://craigmod.com/journal/kickstartup/"&gt;Kickstartup &amp;mdash; Successful fundraising with Kickstarter &amp;amp; the (re)making of Art Space Tokyo &amp;mdash; Craig Mod&lt;/a&gt;&lt;br/&gt;
Post includes research into common amounts to give as well as donation rates across the lifetime of the campaign.&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-27</feedburner:origLink></item><item><title>Links for 2010-07-26 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/fWHlih0uCX0/wyscan</link><pubDate>Tue, 27 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-26</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://emerose.com/timing-attacks-explained"&gt;Emerose Blog: Timing Attacks Explained&lt;/a&gt;&lt;br/&gt;
Nice, simple explanation and recommended fix.&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-26</feedburner:origLink></item><item><title>Links for 2010-07-24 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/1y2rHA_SdUE/wyscan</link><pubDate>Sun, 25 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-24</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking"&gt;Source Multiplayer Networking - Valve Developer Community&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-24</feedburner:origLink></item><item><title>Links for 2010-07-19 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/22N0mkx9MW0/wyscan</link><pubDate>Tue, 20 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-19</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.androidengineer.com/2010/07/optimizing-obfuscating-and-shrinking.html"&gt;Android Engineer: Optimizing, Obfuscating, and Shrinking your Android Applications with ProGuard&lt;/a&gt;&lt;br/&gt;
The shrinking aspect is particularly appealing.&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-19</feedburner:origLink></item><item><title>Links for 2010-07-15 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/E8gRCMNpI6w/wyscan</link><pubDate>Fri, 16 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-15</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.readwriteweb.com/start/2010/07/ten-inspiring-ted-talks-for-st.php"&gt;10 Inspiring TED Talks for Startups&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-15</feedburner:origLink></item><item><title>Links for 2010-07-13 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/iHHbisr8mKI/wyscan</link><pubDate>Wed, 14 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-13</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blog.sucuri.net/2010/07/understanding-and-cleaning-the-pharma-hack-on-wordpress.html"&gt;Understanding and cleaning the Pharma hack on WordPress | Sucuri&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-13</feedburner:origLink></item><item><title>Links for 2010-07-11 [del.icio.us]</title><link>http://feedproxy.google.com/~r/RunningAsRoot/~3/j7-zqygWl-o/wyscan</link><pubDate>Mon, 12 Jul 2010 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wyscan#2010-07-11</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.connorgarvey.com/blog/?p=41"&gt;Tutorial for creating an icon for an Android button: Part 1 of 2 - Dev Notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html"&gt;Amit&amp;rsquo;s Game Programming Information&lt;/a&gt;&lt;br/&gt;
Good collection of links to quite a few game related resources and articles.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://warriormill.com/2009/10/adroid-game-development-part-1-gameloop-sprites/"&gt;Android Game Development &amp;ndash; Part 1 GameLoop &amp;amp; Sprites | warriormill&lt;/a&gt;&lt;br/&gt;
Good start at simple canvas-based sprite animation in Android.&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/wyscan#2010-07-11</feedburner:origLink></item><item>
		<title>Recreating Foreign Keys in MySQL</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/TrpZqn_K-xg/</link>
		<comments>http://www.runningasroot.com/blog/2009/10/20/recreating-foreign-keys-in-mysql/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 17:38:13 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=422</guid>
		<description><![CDATA[The short version of this story is that I had a test server that was inadvertently configured to use the MyISAM engine of MySQL. This engine doesn't support foreign keys. It will quietly ignore your attempts to add them. I meant to use the InnoDB engine (which does support foreign keys). Of course, who hasn't [...]]]></description>
			<content:encoded><![CDATA[<p>The short version of this story is that I had a test server that was inadvertently configured to use the MyISAM engine of MySQL.  This engine doesn't support foreign keys.  It will quietly ignore your attempts to add them.  I meant to use the InnoDB engine (which does support foreign keys).  Of course, who hasn't done that?  Am I right?</p>
<p>I fixed the engine problem quickly enough.  Next I wanted to take a version of our production / dev / whatever that had the foreign keys and export the necessary "alter table" statements to add them to the fixed version of the test database.  I couldn't find anything so I whipped up this <code>SELECT</code> statement to generate a script based on my limited understanding of MySQL.  If it helps someone else then great.</p>
<pre class="brush: sql;">
SELECT concat('ALTER TABLE `',  table_name, '` ADD CONSTRAINT `', CONSTRAINT_NAME, '` FOREIGN KEY (`', column_name, '`) REFERENCES `', referenced_table_name, '`(`', referenced_column_name, '`);') from information_schema.key_column_usage where referenced_table_name is not null and constraint_schema = 'ourserverdb' order by table_name, column_name
</pre>
<p>This of course results in a whole bunch of rows of the form:</p>
<pre class="brush: sql;">
ALTER TABLE `licensekeys` add constraint `FK_keysIssuerId__appuserId` FOREIGN KEY (`issuer_id`) REFERENCES `app_user`(`id`);
ALTER TABLE `subscription` add constraint `FK_subscription_entity_group_id__entityGroupId` FOREIGN KEY (`entity_group_id`) REFERENCES `entityGroup`(`id`);
ALTER TABLE `user_role` add constraint `FK_userRoleRoleId__roleId` FOREIGN KEY (`role_id`) REFERENCES `role`(`id`);
</pre>
<p>From there it's just a little copy / paste into MySQL command prompt and I'm done.  Incidentally mysqldump with the <code>--no-data</code> flag didn't do quite what I wanted since the foreign key creation is in the middle of a <code>CREATE TABLE</code> statement.  There are surely other ways to do this but this is what worked for me.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=TrpZqn_K-xg:L4ZLqgF8AD0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=TrpZqn_K-xg:L4ZLqgF8AD0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=TrpZqn_K-xg:L4ZLqgF8AD0:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2009/10/20/recreating-foreign-keys-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2009/10/20/recreating-foreign-keys-in-mysql/</feedburner:origLink></item>
		<item>
		<title>Shell Scripting Madness</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/y0Vrt2Mk7to/</link>
		<comments>http://www.runningasroot.com/blog/2009/10/16/shell-scripting-madness/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 21:53:10 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=416</guid>
		<description><![CDATA[Every now and then I bask in the beauty of the simple things. I'm not talking about children smiling, flowers, or any of that other crap. Shell scripting, baby! Today I had to move some SQL statements in some XML document into a Java class. So I needed to change this (which I didn't write): [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I bask in the beauty of the simple things.  I'm not talking about children smiling, flowers, or any of that other crap.  Shell scripting, baby!  Today I had to move some SQL statements in some XML document into a Java class.  So I needed to change this (which I didn't write):</p>
<pre class="brush: xml;">
SELECT CASE
    WHEN primaryStartAge &lt; 20  THEN ' 0 to 19'
	WHEN primaryStartAge BETWEEN 20 AND 29 THEN '20 to 29'
	WHEN primaryStartAge BETWEEN 30 AND 39 THEN '30 to 39'
	WHEN primaryStartAge BETWEEN 40 AND 49 THEN '40 to 49'
	WHEN primaryStartAge BETWEEN 50 AND 59 THEN '50 to 59'
	WHEN primaryStartAge BETWEEN 60 AND 69 THEN '60 to 69'
	WHEN primaryStartAge &gt; 70 THEN '70 and up'
	END as &quot;Primary Start Age Range&quot;,
	count(1) as &quot;Count&quot; FROM analyticsResults
	WHERE calculatorType like ?
	GROUP BY CASE
	WHEN primaryStartAge &lt; 20  THEN ' 0 to 19'
	WHEN primaryStartAge BETWEEN 20 AND 29 THEN '20 to 29'
	WHEN primaryStartAge BETWEEN 30 AND 39 THEN '30 to 39'
	WHEN primaryStartAge BETWEEN 40 AND 49 THEN '40 to 49'
	WHEN primaryStartAge BETWEEN 50 AND 59 THEN '50 to 59'
	WHEN primaryStartAge BETWEEN 60 AND 69 THEN '60 to 69'
	WHEN primaryStartAge &gt; 70 THEN '70 and up'
END
ORDER BY 1 ASC
</pre>
<p>to something like this (which I still didn't write):</p>
<pre class="brush: java;">
&quot;SELECT CASE &quot;
            + &quot;    WHEN primaryStartAge &lt; 20  THEN ' 0 to 19' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 20 AND 29 THEN '20 to 29' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 30 AND 39 THEN '30 to 39' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 40 AND 49 THEN '40 to 49' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 50 AND 59 THEN '50 to 59' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 60 AND 69 THEN '60 to 69' &quot;
            + &quot;    WHEN primaryStartAge &gt; 70 THEN '70 and up' &quot;
            + &quot;    END as \&quot;Primary Start Age Range\&quot;, &quot;
            + &quot;    count(1) as \&quot;Count\&quot; FROM analyticsResults &quot;
            + &quot;    WHERE calculatorType like ? &quot;
            + &quot;    GROUP BY CASE &quot;
            + &quot;    WHEN primaryStartAge &lt; 20  THEN ' 0 to 19' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 20 AND 29 THEN '20 to 29' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 30 AND 39 THEN '30 to 39' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 40 AND 49 THEN '40 to 49' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 50 AND 59 THEN '50 to 59' &quot;
            + &quot;    WHEN primaryStartAge BETWEEN 60 AND 69 THEN '60 to 69' &quot;
            + &quot;    WHEN primaryStartAge &gt; 70 THEN '70 and up' &quot;
            + &quot;END &quot;
            + &quot;ORDER BY 1 ASC&quot;;
</pre>
<p>I could copy and paste and fix it manually, use a text editor with regex search and replace, or something equally bland.  Since it was Friday though i decided to treat myself and do it from a Cygwin shell.  This got me close enough and made me giddy with satisfaction:</p>
<pre class="brush: bash;">
getclip |sed -e 's/&quot;/\\&quot;/g' -e 's/^/&quot;/g' -e 's/$/ &quot; +/g' |putclip
</pre>
<p>This grabs the contents of the clipboard, replaces all quotes with escaped quotes, replaces the beginning of each line with a double quote, and replaces the end of each line with a space / double quote / space / plus combo.  It then sticks it back into the clipboard.  It's not fancy, it could be better, but it was a minor bright point.  And thanks to Cygwin it happened in Windows.  Sort of.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=y0Vrt2Mk7to:UpoRyItJ6VA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=y0Vrt2Mk7to:UpoRyItJ6VA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=y0Vrt2Mk7to:UpoRyItJ6VA:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2009/10/16/shell-scripting-madness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2009/10/16/shell-scripting-madness/</feedburner:origLink></item>
		<item>
		<title>Usability: Suspending and Resuming Shuffle</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/7UU3eVidGcs/</link>
		<comments>http://www.runningasroot.com/blog/2009/08/25/usability-suspending-and-resuming-shuffle/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 20:50:42 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=413</guid>
		<description><![CDATA[So I'm actually using my old iPod again rather than using the ultra-fantastic Pandora (highly recommended by the way) and I had an idea for a feature it should have. Keep in mind I'm several generations behind on my personal media player so this may be in the current iteration. What I'd like to be [...]]]></description>
			<content:encoded><![CDATA[<p>So I'm actually using my old iPod again rather than using the ultra-fantastic <a href="http://pandora.com/">Pandora</a> (highly recommended by the way) and I had an idea for a feature it should have.  Keep in mind I'm several generations behind on my personal media player so this may be in the current iteration.  What I'd like to be able to do is suspend shuffle mode, listen to a few songs by the artist that came up in shuffle, and finally resume shuffle mode.  That's it.  I can do this but it requires navigating through multiple menus.  Not so convenient.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=7UU3eVidGcs:ssoHRtjx7K0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=7UU3eVidGcs:ssoHRtjx7K0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=7UU3eVidGcs:ssoHRtjx7K0:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2009/08/25/usability-suspending-and-resuming-shuffle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2009/08/25/usability-suspending-and-resuming-shuffle/</feedburner:origLink></item>
		<item>
		<title>Ruby One Liner to Sort and Run Length Encode a String</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/QL7DEPrNq6c/</link>
		<comments>http://www.runningasroot.com/blog/2008/12/30/ruby-one-liner-to-sort-and-pseudo-compress-a-string/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 23:11:23 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=406</guid>
		<description><![CDATA[I'm not a Ruby programmer but I thought this was kind of cool. While poking around on Stack Overflow the subject of storing letter frequency for words came up. While there may be a better solution, the idea of alphabetizing the word and storing letter frequencies of 3 or over as the number of occurrences [...]]]></description>
			<content:encoded><![CDATA[<p>I'm not a Ruby programmer but I thought this was kind of cool.  While <a href="http://stackoverflow.com/questions/401467/how-to-reduce-the-size-of-an-sqlite3-database-for-iphone#401518">poking around on Stack Overflow</a> the subject of storing letter frequency for words came up.  While there may be a better solution, the idea of alphabetizing the word and storing letter frequencies of 3 or over as the number of occurrences followed by the letter seemed like a passable solution.  For instance, "mississippi" is alphabetized to "iiiimppssss" and the multiple occurrences are further reduced to result in "4impp4s".  Seems simple enough and in the case being discussed it would result in very little impact on the storage mechanism or the code around it.</p>
<p>The whole thing turns out to be pretty easy as a Ruby one liner:</p>
<pre class="brush: ruby;">
&quot;mississippi&quot;.split( // ).sort.join.gsub(/(.)\1{2,}/) { |s| s.length.to_s + s[0,1] }
</pre>
<p>That can probably be made a lot better by a Ruby expert.  The regular expression finds any character followed by the same character two or more times and then passes the matching string to the following block as a parameter <code>s</code>.  It then returns the replacement string which will be the length of the matched string (the character count) followed by one of characters from the matching string.  It executes this as a global substitution on the original string.  Wha-bam!!!  I wonder if there's an odd edge case where this breaks.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=QL7DEPrNq6c:Fnm2iCN4Dv0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=QL7DEPrNq6c:Fnm2iCN4Dv0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=QL7DEPrNq6c:Fnm2iCN4Dv0:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/12/30/ruby-one-liner-to-sort-and-pseudo-compress-a-string/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/12/30/ruby-one-liner-to-sort-and-pseudo-compress-a-string/</feedburner:origLink></item>
		<item>
		<title>Street View, Baby!</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/FsO8amWDfCU/</link>
		<comments>http://www.runningasroot.com/blog/2008/12/10/street-view-baby/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 23:36:49 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[parntering]]></category>
		<category><![CDATA[street view]]></category>
		<category><![CDATA[synergy]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=400</guid>
		<description><![CDATA[I just got through reading a post that Google doubled its Street View coverage. I will admit that I know roughly zero about the inner workings of Google but this gave me an idea that I can in no way use to my benefit. What if the setup for equipping a car with the "Street [...]]]></description>
			<content:encoded><![CDATA[<p>I just got through reading a post that <a href="http://news.cnet.com/8301-17939_109-10120351-2.html?part=rss&#038;tag=feed&#038;subj=Webware">Google doubled its Street View</a> coverage.  I will admit that I know roughly zero about the inner workings of Google but this gave me an idea that I can in no way use to my benefit.  </p>
<p>What if the setup for equipping a car with the "Street View hardware" was sufficiently unobtrusive that you could easily mount it on your rental car?  Would it be worth it for Google to partner with a rental car company and offer a $5 or $10 per day discount on your rental fee?  Or better yet, what about partnering with U-Haul?  Would the information be too redundant (everyone driving around in the same locations) or just plain useless (like empty stretches of interstate highways)?  </p>
<p>Just a random thought.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=FsO8amWDfCU:8ukUA3SlhWU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=FsO8amWDfCU:8ukUA3SlhWU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=FsO8amWDfCU:8ukUA3SlhWU:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/12/10/street-view-baby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/12/10/street-view-baby/</feedburner:origLink></item>
		<item>
		<title>Linux in the (Wannabe) Enterprise</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/Kli2hbqRtus/</link>
		<comments>http://www.runningasroot.com/blog/2008/12/10/linux-in-the-wannabe-enterprise/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 20:28:20 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[monitoring]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=389</guid>
		<description><![CDATA[The footholds of Linux in small Windows shops are skunkworks projects and discarded hardware. Inevitably the old mail server or the equivalent is considered woefully underpowered and gets replaced. The old hardware sits in a corner of the server room and collects dust. That is until I need a "no money down" VMWare solution. Of [...]]]></description>
			<content:encoded><![CDATA[<p>The footholds of Linux in small Windows shops are skunkworks projects and discarded hardware.  Inevitably the old mail server or the equivalent is considered woefully underpowered and gets replaced.  The old hardware sits in a corner of the server room and collects dust.  That is until I need a "no money down" VMWare solution.</p>
<p>Of course the downside of this is that you will find yourself installing on frequently inadequate, old hardware that may or may not work&#8211;no one ever seems to be sure.  When something goes wrong it's Linux's fault.  Such was the case when I had to install on an old Dell PowerEdge 600SC.  Of course, the install didn't work right off the bat.  </p>
<p>The install hung with the last message being "Uniform CD-ROM driver Revision: 3.20".  I randomly upgraded the BIOS hoping it's some weird problem with the on-board IDE and see the same problem.  Then I noticed that the CD-ROM is attached to the tertiary channel.  I can't recall ever having that setup before so I moved the CD-ROM drive from the tertiary to the secondary channel (by accident because the order of the IDE connectors from bottom to top of the motherboard appears to be secondary, primary, tertiary).</p>
<p>After the install it appears that I can't get either DHCP or a static IP to work.  Everybody assures me that it's not the IP address they gave me or our DHCP server.  I try a different network card with the same effect.  Finally, I figure out that it is in fact the network of the IP address they gave me that is to blame (and our DHCP server seems to have crapped out at the same time, and no it isn't running on Linux).  But, people stubbornly insist that it's Linux's fault until I waste my time proving otherwise.  While I'm gathering evidence they make a point of wandering by my desk and asking why I'm not just using Windows.  When society collapses they've got a special place on my post apocalyptic TODO list.</p>
<p>I finally get it all working with a fresh install of VMWare 2.0 (hate the new management web app, by the way) and a migrated VM from my desktop that has a copy of <a href="http://www.zenoss.com/">Zenoss Core</a> happily monitoring our new production environment on <a href="http://aws.amazon.com/ec2/">EC2</a>.  Everything in that setup is new from the point of view of this organization.  Of course while I'm patting myself on the back over a job well done, someone asks how to get to the desktop UI.  Although it probably won't help them much I go ahead and install GNOME, VNC, and Webmin on the box even though I consider it a waste.</p>
<p>Now I get to sit back and eagerly await the opportunity to bask in the criticism the next time anything goes wrong with the box.  I'm sure it'll be the fault of that darn Linux.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=Kli2hbqRtus:t-Q0Uxa4IMI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=Kli2hbqRtus:t-Q0Uxa4IMI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=Kli2hbqRtus:t-Q0Uxa4IMI:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/12/10/linux-in-the-wannabe-enterprise/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/12/10/linux-in-the-wannabe-enterprise/</feedburner:origLink></item>
		<item>
		<title>Flat Organization: Job Interview</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/9hnSmLT7WII/</link>
		<comments>http://www.runningasroot.com/blog/2008/11/20/flat-organization-job-interview/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 07:00:16 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[comic]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=384</guid>
		<description><![CDATA[I just don't feel funny this week.]]></description>
			<content:encoded><![CDATA[<p>I just don't feel funny this week.</p>
<p><a href="http://bitstrips.com/read.php?comic_id=146561"><img src="http://bitstrips.com/strips/146561.png"/></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=9hnSmLT7WII:DwfDDoNYgCQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=9hnSmLT7WII:DwfDDoNYgCQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=9hnSmLT7WII:DwfDDoNYgCQ:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/11/20/flat-organization-job-interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/11/20/flat-organization-job-interview/</feedburner:origLink></item>
		<item>
		<title>Flat Organization: It's an Art Form</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/qrpX4ehDSZw/</link>
		<comments>http://www.runningasroot.com/blog/2008/11/12/flat-organization-its-an-art-form/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 23:53:11 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[comic]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=374</guid>
		<description />
			<content:encoded><![CDATA[<p><a href="http://bitstrips.com/read.php?comic_id=141251"><img src="http://bitstrips.com/strips/141251.png"/></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=qrpX4ehDSZw:n_IrdWR96Bs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=qrpX4ehDSZw:n_IrdWR96Bs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=qrpX4ehDSZw:n_IrdWR96Bs:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/11/12/flat-organization-its-an-art-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/11/12/flat-organization-its-an-art-form/</feedburner:origLink></item>
		<item>
		<title>Flat Organization: The "Lost" Episodes</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/MRM49swSFn8/</link>
		<comments>http://www.runningasroot.com/blog/2008/11/06/flat-organization-the-lost-episodes/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 16:01:56 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[comic]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=370</guid>
		<description><![CDATA[Before I started putting the comic directly on my blog, I had a few other episodes of Flat Organization. Since many people never click through to my BitStrips page I'm going to lump all of the "missing" episodes into this one post. I could post them individually but that seems more annoying and like it [...]]]></description>
			<content:encoded><![CDATA[<p>Before I started putting the comic directly on my blog, I had a few other episodes of Flat Organization.  Since many people never click through to my <a href="http://bitstrips.com/series/9713/">BitStrips page</a> I'm going to lump all of the "missing" episodes into this one post.  I could post them individually but that seems more annoying and like it would require more effort.  Apologies to those that have already seen these.</p>
<p><a href="http://bitstrips.com/read.php?comic_id=18612"><img src="http://bitstrips.com/strips/18612.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=18700"><img src="http://bitstrips.com/strips/18700.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=24868"><img src="http://bitstrips.com/strips/24868.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=30163"><img src="http://bitstrips.com/strips/30163.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=30662"><img src="http://bitstrips.com/strips/30662.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=30811"><img src="http://bitstrips.com/strips/30811.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=42098"><img src="http://bitstrips.com/strips/42098.png"/></a></p>
<p><a href="http://bitstrips.com/read.php?comic_id=42131"><img src="http://bitstrips.com/strips/42131.png"/></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=MRM49swSFn8:sBwR2MkT5-Q:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=MRM49swSFn8:sBwR2MkT5-Q:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=MRM49swSFn8:sBwR2MkT5-Q:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/11/06/flat-organization-the-lost-episodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/11/06/flat-organization-the-lost-episodes/</feedburner:origLink></item>
		<item>
		<title>Nobody Paints Baby in a Corner</title>
		<link>http://feedproxy.google.com/~r/RunningAsRoot/~3/LR8HBWlDdNs/</link>
		<comments>http://www.runningasroot.com/blog/2008/11/05/nobody-paints-baby-in-a-corner/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 21:11:27 +0000</pubDate>
		<dc:creator>Robert Simmons</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[comic]]></category>

		<guid isPermaLink="false">http://www.runningasroot.com/blog/?p=362</guid>
		<description><![CDATA[Unfortunately this week's comic just feels like I'm getting more and more bitter. Maybe the next one will be funny.]]></description>
			<content:encoded><![CDATA[<p>Unfortunately this week's comic just feels like I'm getting more and more bitter.  Maybe the next one will be funny.</p>
<p><a href="http://bitstrips.com/read.php?comic_id=137068"><img src="http://bitstrips.com/strips/137068.png"/></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.runningasroot.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=LR8HBWlDdNs:vJDjyI1kv1s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=LR8HBWlDdNs:vJDjyI1kv1s:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/RunningAsRoot?a=LR8HBWlDdNs:vJDjyI1kv1s:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/RunningAsRoot?d=YwkR-u9nhCs" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.runningasroot.com/blog/2008/11/05/nobody-paints-baby-in-a-corner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://www.runningasroot.com/blog/2008/11/05/nobody-paints-baby-in-a-corner/</feedburner:origLink></item>
	</channel>
</rss>
