<?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/"
	>

<channel>
	<title>Pete Ware</title>
	<atom:link href="http://peteware.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://peteware.com</link>
	<description>Tech, Politics, and NYC</description>
	<lastBuildDate>Fri, 27 Aug 2010 02:14:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>C++ test for within</title>
		<link>http://peteware.com/2010/08/c-test-for-within/</link>
		<comments>http://peteware.com/2010/08/c-test-for-within/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 00:40:00 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[stl]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=950</guid>
		<description><![CDATA[I found myself having to right a bunch of range checking code like this: if &#40;val &#160;1.0&#41; &#160; &#160; val = 1.0; so I wrote this simple function. #include &#34;algorithm&#34; template const Type &#38;amp; within &#40;const Type &#38;amp;lower, const Type &#38;amp;val, const Type &#38;amp;upper&#41; &#123; &#160; &#160; return std::min &#40;std::max &#40;lower, val&#41;, upper&#41;; &#125; So [...]]]></description>
			<content:encoded><![CDATA[<p>I found myself having to right a bunch of range checking code like this:</p>

<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>val &nbsp;<span style="color:#800080;">1.0</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; val <span style="color: #000080;">=</span> <span style="color:#800080;">1.0</span><span style="color: #008080;">;</span></div></div>

<p>so I wrote this simple function.</p>

<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339900;">#include &quot;algorithm&quot;</span><br />
<span style="color: #0000ff;">template</span><br />
<span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> within <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>lower, <span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>val, <span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>upper<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">return</span> std<span style="color: #008080;">::</span><span style="color: #007788;">min</span> <span style="color: #008000;">&#40;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">max</span> <span style="color: #008000;">&#40;</span>lower, val<span style="color: #008000;">&#41;</span>, upper<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>

<p>So the above code gets simplified to:</p>

<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">val <span style="color: #000080;">=</span> within<span style="color: #008000;">&#40;</span><span style="color:#800080;">0.0</span>, val, <span style="color:#800080;">1.0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></div>

<p>I wasn&#8217;t happy about the extra copy being created but was willing to live with it.</p>

<p>Then I ran across this fragment which is so similar but ended  up changing the final design:</p>

<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>val <span style="color: #000080;">==</span> <span style="color: #0000dd;">10</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; val <span style="color: #000080;">=</span> <span style="color: #0000dd;">5</span><span style="color: #008080;">;</span></div></div>

<p>The difference is the above check sets an arbitrary value if it wasn&#8217;t within the range instead of just assigning one of the bounds to the value.  That caused me to split it into a test, within(), to handle this case and a setwithin() to handle the earlier cases.</p>

<p>Splitting it also let me do a minor optimization.  The typical case is that being out of bounds is rather exceptional and it&#8217;d be nice to avoid doing a copy.  Accordingly, setwithin() checks if the dest has the same address as the replacement value and avoids doing the assignment.</p>

<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">template</span> <br />
<span style="color: #0000ff;">int</span> within <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> lower, <span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> val, <span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> upper<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>val <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> lower<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>upper <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> val<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span><br />
<span style="color: #008000;">&#125;</span><br />
<br />
<span style="color: #0000ff;">template</span> <br />
<span style="color: #0000ff;">int</span> setwithin <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> lower, <span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> val, <span style="color: #0000ff;">const</span> Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> upper, Type <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> dest<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">int</span> res <span style="color: #000080;">=</span> within <span style="color: #008000;">&#40;</span>lower, val, upper<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">switch</span> <span style="color: #008000;">&#40;</span>res<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">case</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>lower <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>dest<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dest <span style="color: #000080;">=</span> lower<span style="color: #008080;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>val <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>dest<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dest <span style="color: #000080;">=</span> val<span style="color: #008080;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>upper <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>dest<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dest <span style="color: #000080;">=</span> upper<span style="color: #008080;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">return</span> res<span style="color: #008080;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/08/c-test-for-within/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Way funny way to quit!</title>
		<link>http://peteware.com/2010/08/way-funny-way-to-quit/</link>
		<comments>http://peteware.com/2010/08/way-funny-way-to-quit/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 03:14:26 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[funny]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=944</guid>
		<description><![CDATA[This woman used a dry erase board and sent email to everyone to quit. I especially like how she reports on her boss. Editted Aug 10. Sadly, it&#8217;s a hoax: Techcrunch: “Girl quits her job on dry erase board, emails entire office (33 Photos)” is indeed a hoax, say its creators John and Leo Resig.]]></description>
			<content:encoded><![CDATA[<p>This woman used a dry erase board and sent email to everyone to <a href="http://thechive.com/2010/08/10/girl-quits-her-job-on-dry-erase-board-emails-entire-office-33-photos/">quit</a>.  I especially like how she reports on her boss.</p>

<p><img style="margin-left:auto;margin-right:auto" src="http://peteware.com/files/2010/08/quits.jpeg" alt="quits.jpeg" border="0" width="500" height="333" /></p>

<p>Editted Aug 10.</p>

<h2>Sadly, it&#8217;s a hoax:</h2>

<p><a href="http://techcrunch.com/2010/08/11/elyse-porterfield/">Techcrunch</a>:</p>

<blockquote>
“Girl quits her job on dry erase board, emails entire office (33 Photos)” is indeed a hoax, say its creators John and Leo Resig.
</blockquote>

<p><img style="margin-left:auto;margin-right:auto" src="http://peteware.com/files/2010/08/girl.jpeg" alt="girl.jpeg" border="0" width="630" height="430" /></p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/08/way-funny-way-to-quit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Federal budget overview</title>
		<link>http://peteware.com/2010/07/federal-budget-overview/</link>
		<comments>http://peteware.com/2010/07/federal-budget-overview/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 00:04:11 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[politics]]></category>
		<category><![CDATA[federal budget]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=941</guid>
		<description><![CDATA[Here&#8217;s a great overview from Barry Ritholz showing how the Federal budget is proportioned.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a great overview from <a href="http://www.ritholtz.com/blog/2010/07/do-deficits-matter-not-to-us/">Barry Ritholz</a> showing how the Federal budget is proportioned.</p>

<p><a href="http://peteware.com/files/2010/07/budget2010.gif"><img src="http://peteware.com/files/2010/07/budget2010.gif" alt="budget2010.gif" border="0" width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/federal-budget-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unemployment won&#8217;t recover for 157 months (2021)</title>
		<link>http://peteware.com/2010/07/unemployment-wont-recover-for-157-months-2021/</link>
		<comments>http://peteware.com/2010/07/unemployment-wont-recover-for-157-months-2021/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 21:38:46 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[politics]]></category>
		<category><![CDATA[economics]]></category>
		<category><![CDATA[unemployment]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=938</guid>
		<description><![CDATA[If we look at employment prior to the Great Recession compared to now there is a difference of 11.3 million jobs (from Bookings institute). Now how long is it going to take to return to that level? If you take the best job growth of the 2000&#8242;s it&#8217;ll be 157 months or 11years. That&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p>If we look at employment prior to the Great Recession compared to now there is a difference of <a href="http://www.brookings.edu/opinions/2010/0702_jobs_greenstone.aspx">11.3 million jobs</a> (from Bookings institute).  Now how long is it going to take to return to that level?  If you take the <em>best</em> job growth of the 2000&#8242;s it&#8217;ll be 157 months or 11years.  That&#8217;s not until 2021!</p>

<p>If you take the best rate from the 1990&#8242;s it&#8217;s down to about 8 years!  Here&#8217;s the chart with how many months it&#8217;ll take based on the rate with a couple note worthy rates highlighted.</p>

<p><a href="http://peteware.com/files/2010/07/grab-001.png"><img src="http://peteware.com/files/2010/07/grab-001.png" alt="grab-001.png" border="0" width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/unemployment-wont-recover-for-157-months-2021/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone4 and FaceTime</title>
		<link>http://peteware.com/2010/07/iphone4-and-facetime/</link>
		<comments>http://peteware.com/2010/07/iphone4-and-facetime/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 02:51:42 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=935</guid>
		<description><![CDATA[I&#8217;d been surprised about Apple emphasizing FaceTime in advertising. I don&#8217;t think it&#8217;s very compelling &#8212; I don&#8217;t know enough people with an iPhone4, I rarely have a Wi-Fi connection when I want to talk to them, and I don&#8217;t find video chats very compelling anyway. After all, how often do you video iChat or [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d been surprised about Apple emphasizing <a href="http://www.apple.com/iphone/features/facetime.html">FaceTime</a> in advertising.  I don&#8217;t think it&#8217;s very compelling &#8212; I don&#8217;t know enough people with an iPhone4, I rarely have a Wi-Fi connection when I want to talk to them, and I don&#8217;t find video chats very compelling anyway.  After all, how often do you video iChat or Skype?</p>

<p>Anyway, <a href="http://techcrunch.com/2010/07/10/apple-facetime-commercial/">TechCrunch</a> had an interesting perspective about it when they compared it to a scene from <a href="http://www.imdb.com/title/tt0804503/">Mad Men</a> (<a href="http://www.amctv.com/originals/madmen/">official site</a>.  They are getting people to make an emotional connection with the iPhone rather then the analytical one of feature X vs. feature Y.</p>

<p><div style="float:left;margin-right: 10px;"><span class="youtube">
<object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/bCzzh-nexpg&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0?rel=1&amp;feature=player_embedded" />
<param name="allowFullScreen" value="true" />
<embed wmode="transparent" src="http://www.youtube.com/v/bCzzh-nexpg&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0?rel=1&amp;feature=player_embedded" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355"></embed>
<param name="wmode" value="transparent" />
</object>
</span><p><a href="http://www.youtube.com/watch?v=bCzzh-nexpg">www.youtube.com/watch?v=bCzzh-nexpg</a></p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/iphone4-and-facetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More exonerations for Climategate researchers</title>
		<link>http://peteware.com/2010/07/more-exonerations-for-climategate-researchers/</link>
		<comments>http://peteware.com/2010/07/more-exonerations-for-climategate-researchers/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 13:45:49 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[politics]]></category>
		<category><![CDATA[climate]]></category>
		<category><![CDATA[environment]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=929</guid>
		<description><![CDATA[Yet another report says Michael E Mann is cleared of any wrongdoing related to his climate research. An investigative panel at Pennsylvania State University, weighing the question of whether the scientist, Michael E. Mann, had “seriously deviated from accepted practices within the academic community for proposing, conducting or reporting research or other scholarly activities,” declared [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another report says <a href="http://www.nytimes.com/2010/07/02/science/earth/02climate.html?_r=1">Michael E Mann</a> is cleared of any wrongdoing related to his climate research.</p>

<blockquote>
An investigative panel at Pennsylvania State University, weighing the question of whether the scientist, Michael E. Mann, had “seriously deviated from accepted practices within the academic community for proposing, conducting or reporting research or other scholarly activities,” declared that he had not.
</blockquote>

<p>This is the second report from Penn St. clearing him and joins two others in Britain clearing related researchers.</p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/more-exonerations-for-climategate-researchers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Senator Robert Byrd</title>
		<link>http://peteware.com/2010/07/senator-robert-byrd/</link>
		<comments>http://peteware.com/2010/07/senator-robert-byrd/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 22:54:00 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[politics]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=927</guid>
		<description><![CDATA[From Frank Rich&#8217;s column about Senator Robert Byrd. These senators were in the tradition of Thurmond, not Byrd — indeed, they are Thurmond’s direct heirs. Like Byrd, Thurmond had been an ardent Democratic foe of the Civil Rights Act of 1964. Unlike Byrd, he left his party in disgust that year and endorsed Goldwater, jump-starting [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.nytimes.com/2010/07/04/opinion/04rich.html?ref=opinion">Frank Rich&#8217;s column</a> about Senator Robert Byrd.</p>

<blockquote>
These senators were in the tradition of Thurmond, not Byrd — indeed, they are Thurmond’s direct heirs. Like Byrd, Thurmond had been an ardent Democratic foe of the Civil Rights Act of 1964. Unlike Byrd, he left his party in disgust that year and endorsed Goldwater, jump-starting the migration of the Democrats’ racist cadre and their political toxins to the G.O.P. and setting the stage for the Republican “Southern strategy.” That strategy isn’t dead.
</blockquote>

<p>The <a href="http://www.nytimes.com/2010/06/29/us/politics/29byrd.html">NY Times</a>  had an interesting obituary about Senator Byrd including his Ku Klux Klan membership, title as &#8220;King of Pork&#8221;</p>

<blockquote>
Mr. Byrd’s perspective on the world changed over the years. A former member of the Ku Klux Klan, he filibustered against the 1964 Civil Rights Act only to come to back civil rights measures and Mr. Obama. A supporter of the Vietnam War, he became a fierce critic, decades later, of the war in Iraq. In 1964, the Americans for Democratic Action, the liberal lobbying group, found that his views and the group’s aligned only 16 percent of the time. In 2005, he got an A.D.A. rating of 95.
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/senator-robert-byrd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching keys in values in a map</title>
		<link>http://peteware.com/2010/07/switching-keys-in-values-in-a-map/</link>
		<comments>http://peteware.com/2010/07/switching-keys-in-values-in-a-map/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 19:35:29 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[stl]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=922</guid>
		<description><![CDATA[A functor that reverses a pair: first becomes second, second becomes first. Useful for switching from a map to another map (or multimap in this example) where the value becomes the key and the key the value. std::map m; std::multimap m2; m["a"] = 0; m["b"] = 1; m["c"] = 0; std::transform (m.begin(), m.end(), std::inserter (m2, [...]]]></description>
			<content:encoded><![CDATA[<p>A functor that reverses a pair: first becomes second,
second becomes first.  Useful for switching
from a map to another map (or multimap in this example) where
the value becomes the key and the key the value.</p>

<p><pre lang="cpp">
  std::map m;
  std::multimap m2;
  m["a"] = 0;
  m["b"] = 1;
  m["c"] = 0;
  std::transform (m.begin(), m.end(), std::inserter (m2, m2.begin()),
                  pair_switch&lt;std::map::value_type&gt; ());
</pre></p>

<p>And the actual code:
<pre lang="cpp">
template
struct pair_switch : public std::unary_function&lt;
    std::pair,
    std::pair &gt;
{
    typedef std::pair argument_type;
    typedef std::pair argument_type2;
    typedef std::pair argument_type3;
    typedef std::pair result_type;</p>

<pre><code>result_type operator()(const argument_type3 &amp;amp;p) const
{
    return result_type (p.second, p.first);
}
</code></pre>

<p>};
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/switching-keys-in-values-in-a-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Best Party: Campaign video from Iceland</title>
		<link>http://peteware.com/2010/07/the-best-party-campaign-video-from-iceland/</link>
		<comments>http://peteware.com/2010/07/the-best-party-campaign-video-from-iceland/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 16:11:28 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[iceland]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=919</guid>
		<description><![CDATA[&#8220;The Best Party&#8221; has this campaign video where they won city elections in Reykjavik. This is amusing and campy. I especially like the line &#8220;A drug free parliament by 2020!&#8221; www.youtube.com/watch?v=xxBW4mPzv6E]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Best Party&#8221; has this campaign video where they won city elections in Reykjavik.  This is amusing and campy.  I especially like the line &#8220;A drug free parliament by 2020!&#8221;</p>

<p><div style="float:left;margin-right: 10px;"><span class="youtube">
<object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/xxBW4mPzv6E&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0?rel=1&amp;feature=player_embedded" />
<param name="allowFullScreen" value="true" />
<embed wmode="transparent" src="http://www.youtube.com/v/xxBW4mPzv6E&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0?rel=1&amp;feature=player_embedded" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355"></embed>
<param name="wmode" value="transparent" />
</object>
</span><p><a href="http://www.youtube.com/watch?v=xxBW4mPzv6E">www.youtube.com/watch?v=xxBW4mPzv6E</a></p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/the-best-party-campaign-video-from-iceland/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 3.0 update</title>
		<link>http://peteware.com/2010/07/wordpress-3-0-update/</link>
		<comments>http://peteware.com/2010/07/wordpress-3-0-update/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 21:19:50 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://peteware.com/?p=909</guid>
		<description><![CDATA[Update to 3.0 went pretty smoothly. I&#8217;m having some problem with images (added how to fix below) Ran my custom backup script: $ cd ~/Desktop/wp-backup $ ./backup Downloaded wordpress 3.0: $ cd ~/Desktop/src/downloads/pkgs $ curl -O http://wordpress.org/latest.tar.gz $ mv latest.tar.gz wordpress-3.0.tgz Make sure you know the WP administrator user password as WP 3.0 uses a [...]]]></description>
			<content:encoded><![CDATA[<p>Update to 3.0 went pretty smoothly.  I&#8217;m having some problem with images (added how to fix below)</p>

<ul>
<li>Ran my custom backup script:
<pre lang="bash">
$ cd ~/Desktop/wp-backup
$ ./backup
</pre></li>
<li>Downloaded wordpress 3.0:
<pre lang="bash">
$ cd ~/Desktop/src/downloads/pkgs
$ curl -O http://wordpress.org/latest.tar.gz
$ mv latest.tar.gz wordpress-3.0.tgz
</pre></li>
<li>Make sure you know the WP administrator user password as WP 3.0 uses a &#8220;Super Admin&#8221; interface.</li>
<li>No real special requirements for my site for <a href="http://wpmu.org/important-things-you-should-know-before-upgrading-to-wordpress-3-0/#more-33969">wpmu upgrade</a> most a lot of warnings about plugins and themes not necessarily being compatible.</li>
<li>Follow the <a href="http://codex.wordpress.org/Upgrading_WordPress">directions</a> or these <a href="http://developersmind.com/2010/06/17/upgrading-wordpress-mu-2-9-2-to-wordpress-3-0/">even better</a> directions

<ul>
<li>Disable plugins from site admin web page</li>
<li>Remove (save somewhere else) wp-admin, wp-includes</li>
<li>Extract the wordpress-3.0.files</li>
<li>Fix permisions (this is Apple&#8217;s Snow Leopard Server)
<pre lang="bash">
$ cd /Library/Webserver/Documents
$ mv wp-admin wp-includes ~/tmp
$ tar xzvf ~/Desktop/src/downloads/pgks/wordpress-3.0.tgz
$ chown -R _www:_www .
</pre></li>
</ul></li>
<li>remove blogs.php
<pre lang="bash">
$ cd /Library/Webserver/Documents
$ rm wp-content/blogs.hp
</pre></li>
<li><p>Modify .htaccess to add the rule for wp-files (replacings blogsphp):
<pre>
RewriteCond %{REQUEST_URI} !.<em>wp-content/plugins.</em>
RewriteRule ^(.<em>/)?files/(.</em>) wp-includes/ms-files.php?file=$2 [L]
</pre></p></li>
<li><p>Upgrade the site (site.com/wp-admin/upgrade.php).  Login as the administrator user, if you don&#8217;t see &#8220;Super Admin&#8221; you aren&#8217;t the right user.</p></li>
<li>My site admin had some extra steps to perform like getting rid of blogs.php and adding some code
for the cookies.</li>
<li>Update the plugins</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://peteware.com/2010/07/wordpress-3-0-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
