<?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>Varied Thoughts</title>
	<atom:link href="http://variedthoughts.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://variedthoughts.com</link>
	<description>A Programmers Notebook</description>
	<lastBuildDate>Wed, 25 Apr 2012 16:19:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>pytest from behind a firewall</title>
		<link>http://variedthoughts.com/programming/pytest-firewall/</link>
		<comments>http://variedthoughts.com/programming/pytest-firewall/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 22:40:16 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[pytest]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=330</guid>
		<description><![CDATA[I wanted to try out pytest (or py.test, I&#8217;ve heard it both ways). But I&#8217;m behind a firewall, so pip and easy_install don&#8217;t work that great. I&#8217;m also running cygwin, with several versions of python so I can test compatibility of scripts across 2.6, 2.7, and 3.2. Trial and error gets me to these steps [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to try out <a href="http://pytest.org">pytest</a> (or py.test, I&#8217;ve heard it both ways).<br />
But I&#8217;m behind a firewall, so pip and easy_install don&#8217;t work that great.<br />
I&#8217;m also running cygwin, with several versions of python so I can test compatibility of scripts across 2.6, 2.7, and 3.2.</p>
<p>Trial and error gets me to these steps that seem to work.</p>
<ol>
<li><a href="http://pypi.python.org/pypi/py">download py</a></li>
<li>unpack it to directory py147 (whatever you want to name it)</li>
<li><a href="http://pypi.python.org/pypi/pytest">download pytest</a></li>
<li> unpack it to directory pytest223 (again, whatever you want to name it)</li>
<li>install py (see below)</li>
<li>install pytest (see below)</li>
</ol>
<p>In this example, I&#8217;ve got a symbolic link in my path called python27 that links to my python 2.7 executable.</p>
<pre class="brush: bash; title: ; notranslate">
&gt; cd py147
&gt; python27 setup.py install
&gt; cd ../pytest223
&gt; python27 setup.py install

# now test it by running one of the pytest included scripts
&gt; cd testing
&gt; python27 -m pytest test_python.py
</pre>
<p>Splendid.<br />
Now getting on to the task of examining it to see if it&#8217;s functionality meets my needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/pytest-firewall/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Testing in Python</title>
		<link>http://variedthoughts.com/programming/testing-python/</link>
		<comments>http://variedthoughts.com/programming/testing-python/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 16:59:53 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[pytest]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=326</guid>
		<description><![CDATA[I&#8217;ve been using Python for writing test code for many years now. I&#8217;ve used several test frameworks, most of them proprietary. However, I&#8217;d like to utilize some of the open source frameworks available. Right now, I&#8217;m doing two things. 1. Writing my own framework. 2. Investigating pytest. Hopefully I will have some results from both [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Python for writing test code for many years now.<br />
I&#8217;ve used several test frameworks, most of them proprietary.<br />
However, I&#8217;d like to utilize some of the open source frameworks available.</p>
<p>Right now, I&#8217;m doing two things.<br />
1. Writing my own framework.<br />
2. Investigating <a href="http://pytest.org">pytest</a>.</p>
<p>Hopefully I will have some results from both experiences to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/testing-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ zero padded string from int</title>
		<link>http://variedthoughts.com/programming/padded-string-int/</link>
		<comments>http://variedthoughts.com/programming/padded-string-int/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 22:35:53 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[stdlib]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=300</guid>
		<description><![CDATA[Using an output string stream is a handy way to convert a number to a string. However, what if you want to zero pad the number. Well, that&#8217;s where iomanip comes in handy. output:]]></description>
			<content:encoded><![CDATA[<p>Using an output string stream is a handy way to convert a number to a string.</p>
<p>However, what if you want to zero pad the number.</p>
<p>Well, that&#8217;s where iomanip comes in handy.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;iomanip&gt;  // for setw, setfill
#include &lt;iostream&gt; // for cout
#include &lt;sstream&gt;  // for ostringstream
#include &lt;string&gt;   // for string

using namespace std;

int main ()
{
  int i = 1;

  ostringstream ss;
  ss &lt;&lt; setw( 3 ) &lt;&lt; setfill( '0' ) &lt;&lt; i;
  string s = ss.str();

  cout &lt;&lt; &quot;i: &quot; &lt;&lt; i &lt;&lt; endl;
  cout &lt;&lt; &quot;s: &quot; &lt;&lt; s &lt;&lt; endl;
  return 0;
}
</pre>
<p>output:</p>
<pre class="brush: bash; title: ; notranslate">
i: 1
s: 001
</pre>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/padded-string-int/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ variable scope and the for loop</title>
		<link>http://variedthoughts.com/programming/c-variable-scope-for-loop/</link>
		<comments>http://variedthoughts.com/programming/c-variable-scope-for-loop/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 20:28:29 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=289</guid>
		<description><![CDATA[C++ allows you to re-use variables in nested scopes. A confusion arises sometimes, especially with those new to C++ rules, as to the variables at the top of a for loop. In a for loop, such as for (int i = 0; i < 2; i++) { ... }, does the int i belong to [...]]]></description>
			<content:encoded><![CDATA[<p>C++ allows you to re-use variables in nested scopes.</p>
<p>A confusion arises sometimes, especially with those new to C++ rules, as to the variables at the top of a for loop.</p>
<p>In a for loop, such as <strong>for (<em>int i</em> = 0; i < 2; i++) { ... }</strong>, does the <em>int i</em> belong to the outer scope or the scope within the for loop.</p>
<p>The answer is that it belongs to the inner loop, and hides any outer variables, if they exist.<br />
Of course, this is best shown with an example.</p>
<p>Three variables: i, j, k<br />
Variable i is defined both in the outer scope and as a loop index variable defined in the top of the for statement.<br />
Variable j is defined both in the outer scope and within the curly brackets of the for loop.<br />
Variable k is only defined in the outer scope.</p>
<p>The treatment of i is the same as j. It&#8217;s as if all of the statements at the top of the for loop are <em>inside</em> the curly brackets of the for loop.</p>
<p>Sample Code:</p>
<pre class="brush: cpp; title: ; notranslate">
#include
using namespace std;

void report(string label, int i, int j, int k)
{
  cout &lt;&lt; label &lt;&lt; &quot; i:&quot; &lt;&lt; i &lt;&lt; &quot; j: &quot; &lt;&lt; j &lt;&lt; &quot; k: &quot; &lt;&lt; k &lt;&lt; endl;
}

int main ()
{
  int i = 123;
  int j = 456;
  int k = 789;

  report(&quot;before loop&quot;, i, j, k);
  cout &lt;&lt; endl;

  // inner scope i hides outer scope i
  for (int i = 0; i &lt; 2; i++)
  {
    // inner scope j hides outer scope j
    // outer scope k not hidden
    int j = i;
    report(&quot;in for loop&quot;, i, j, k);
  }
  cout &lt;&lt; endl;
  report(&quot;after loop &quot;, i, j, k);
  return 0;
}
</pre>
<p>output:</p>
<pre class="brush: bash; title: ; notranslate"> &gt; g++ -Wall -o scope for_loop_scope.cpp
&gt; ./scope
before loop i:123 j: 456 k: 789

in for loop i:0 j: 0 k: 789
in for loop i:1 j: 1 k: 789

after loop  i:123 j: 456 k: 789
</pre>
<p>Please leave a comment if you feel I&#8217;ve gotten something wrong here.<br />
If your compiler does something different, I want to hear about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/c-variable-scope-for-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling C++ code on the command line</title>
		<link>http://variedthoughts.com/programming/compiling-cpp-command-line/</link>
		<comments>http://variedthoughts.com/programming/compiling-cpp-command-line/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 18:04:41 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[gpp]]></category>
		<category><![CDATA[stdlib]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=280</guid>
		<description><![CDATA[Quick instructions for compiling small C++ projects on the command line in bash. My normal development environment is to edit in Vim, and compile in a Visual Studio project. However, I occasionally have an idea that I&#8217;d like to test out by itself, isolated from the rest of the code. My usual solution is to [...]]]></description>
			<content:encoded><![CDATA[<p>Quick instructions for compiling small C++ projects on the command line in bash.<br />
<span id="more-280"></span><br />
My normal development environment is to edit in Vim, and compile in a Visual Studio project.</p>
<p>However, I occasionally have an idea that I&#8217;d like to test out by itself, isolated from the rest of the code.<br />
My usual solution is to write a small test program and compile it on the command line, debugging with writes to the output stream.</p>
<p>As an example, I recently wanted to refresh my memory about how string::find works.<br />
I saw an example program at <a href="http://www.cplusplus.com/reference/string/string/find/">cplusplus.com</a></p>
<p>So to start, I just grabbed the example and saved it to string_find.cpp.</p>
<p>Now to compile it.<br />
Hmmm.<br />
First attempt:</p>
<pre class="brush: bash; title: ; notranslate">
gcc -o string_find string_find.cpp
... massive list of errors omitted ...
</pre>
<p>Well, that wasn&#8217;t it.</p>
<p>Look it up somewhere, can&#8217;t remember where, probably on <a href="http://stackoverflow.com">stackoverflow</a>.</p>
<p>Here&#8217;s what I want:</p>
<pre class="brush: bash; title: ; notranslate">
g++ -Wall -o string_find string_find.cpp
&gt; ./string_find.exe
first 'needle' found at: 14
second 'needle' found at: 44
'haystack' also found at: 30
Period found at: 51
There are two prepositions in this haystack with needles.
</pre>
<p>Awesome.<br />
Now, post this to the blog so I don&#8217;t have to look it up again.<br />
Whew!</p>
<p>Turns out that the gcc command will try to compile c++ code, but doesn&#8217;t link the standard library.<br />
However, g++ does include the standard library, so stuff like are available.</p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/compiling-cpp-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exceptional Cow?</title>
		<link>http://variedthoughts.com/programming/exceptional-cow/</link>
		<comments>http://variedthoughts.com/programming/exceptional-cow/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 19:17:20 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=274</guid>
		<description><![CDATA[I&#8217;ve been meaning to read Exceptional C++ for a while now. I went to check to see if my local library had it. I guess not:]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to read <a href="http://amzn.com/0201615622" title="Exceptional C++" target="_blank">Exceptional C++</a> for a while now.<br />
I went to check to see if my local library had it.<br />
I guess not:<br />
<a href="http://variedthoughts.com/wp-content/uploads/2012/03/exceptional_cow.png?cda6c1"><img class="alignleft size-full wp-image-276" title="exceptional_cow" src="http://variedthoughts.com/wp-content/uploads/2012/03/exceptional_cow.png?cda6c1" alt="" width="516" height="79" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/exceptional-cow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happiness is a choice</title>
		<link>http://variedthoughts.com/life/happiness-is-a-choice/</link>
		<comments>http://variedthoughts.com/life/happiness-is-a-choice/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 16:55:24 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=268</guid>
		<description><![CDATA[I&#8217;ve long believed that happiness is a choice. This recent CNN article is very interesting. Is happiness the secret of success? &#8211; CNN.com Some people think if you are happy, you are blind to reality. But when we research it, happiness actually raises every single business and educational outcome for the brain. How did we [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve long believed that happiness is a choice.<br />
This recent CNN article is very interesting.</p>
<p><a href="http://www.cnn.com/2012/03/19/opinion/happiness-success-achor/index.html?c=&amp;page=1">Is happiness the secret of success? &#8211; CNN.com</a></p>
<blockquote cite="http://www.cnn.com/2012/03/19/opinion/happiness-success-achor/index.html?c=&amp;page=1"><p>Some people think if you are happy, you are blind to reality. But when we research it, happiness actually raises every single business and educational outcome for the brain. How did we miss this?</p></blockquote>
<p>Quick read, and very worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/life/happiness-is-a-choice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allow subscribe to comments plugin in startbox</title>
		<link>http://variedthoughts.com/wordpress/startbox-subscribe-comments/</link>
		<comments>http://variedthoughts.com/wordpress/startbox-subscribe-comments/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 15:00:12 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[startbox]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordPress]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=245</guid>
		<description><![CDATA[The startbox theme framework is pretty sweet. I&#8217;ve been trying it out for a while. Actually, I&#8217;m doing exactly what you shouldn&#8217;t do. I&#8217;m running it as my main theme with no child theme. Right now I&#8217;m just collecting notes on things I need to hack to get it to work. I plan on creating a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wpstartbox.com/"><img class="alignright size-full wp-image-236" title="StartBox" src="http://variedthoughts.com/wp-content/uploads/2012/02/logo-1.png?cda6c1" alt="StartBox Logo" width="283" height="52" /></a>The <a title="Startbox Theme Framwork" href="http://wpstartbox.com/">startbox </a>theme framework is pretty sweet.</p>
<p>I&#8217;ve been trying it out for a while. Actually, I&#8217;m doing exactly what you shouldn&#8217;t do. I&#8217;m running it as my main theme with no child theme. Right now I&#8217;m just collecting notes on things I need to hack to get it to work.</p>
<p>I plan on creating a child theme at some point and moving my hacks/mods into the child theme. But for now, this works.</p>
<p>What I want to talk about now is how to add support for the <a href="http://wordpress.org/extend/plugins/subscribe-to-comments/">subscribe to comments plugin</a>.</p>
<p>By default, startbox does not support the plugin. However, this is really just a matter of styling.</p>
<p>Startbox has a line of css that hides the &#8216;Notify me of new posts by email&#8217; text in the comment form. No worries, this can easily be overridden.</p>
<p>Add the following to your css, and all will work spledidly.</p>
<pre class="brush: css; title: ; notranslate">
#commentform label.subscribe-label {display: inline;}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/wordpress/startbox-subscribe-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cleartool label stuff with a new label</title>
		<link>http://variedthoughts.com/programming/cleartool-label-stuff-label/</link>
		<comments>http://variedthoughts.com/programming/cleartool-label-stuff-label/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 19:19:54 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clearcase]]></category>
		<category><![CDATA[cleartool]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=220</guid>
		<description><![CDATA[This is a common thing I have to do. Label stuff with a new label. What stuff? Everything from my current directory down using my current config spec. Here&#8217;s the code mklbtype : create a new label mklabel: apply label]]></description>
			<content:encoded><![CDATA[<p>This is a common thing I have to do.</p>
<p>Label stuff with a new label.</p>
<p>What stuff?</p>
<p>Everything from my current directory down using my current config spec.</p>
<p>Here&#8217;s the code</p>
<pre class="brush: bash; title: ; notranslate">
cleartool mklbtype -nc 'my_new_label'
cleartool mklabel -recurse 'my_new_label' .
</pre>
<p>mklbtype : create a new label</p>
<p>mklabel: apply label</p>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/cleartool-label-stuff-label/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>cleartool obsolete all my branches</title>
		<link>http://variedthoughts.com/programming/cleartool-obsolete-branches/</link>
		<comments>http://variedthoughts.com/programming/cleartool-obsolete-branches/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 16:40:42 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clearcase]]></category>
		<category><![CDATA[cleartool]]></category>

		<guid isPermaLink="false">http://variedthoughts.com/?p=213</guid>
		<description><![CDATA[I want to go through all of the work package branches that belong to me in a particular vob and mark them as obsolete. These are development branches that I don&#8217;t need anymore, and would rather not see in the default version tree. My solution below works because I name all of my development/work package [...]]]></description>
			<content:encoded><![CDATA[<p>I want to go through all of the work package branches that belong to me in a particular vob and mark them as obsolete.</p>
<p>These are development branches that I don&#8217;t need anymore, and would rather not see in the default version tree.</p>
<p>My solution below works because I name all of my development/work package branches with a particular prefix.</p>
<p>Let&#8217;s say my prefix is dev_userName.</p>
<p>So, here&#8217;s the command.</p>
<pre class="brush: bash; title: ; notranslate">
alias ct='cleartool'
for b in $(ct lstype -kind brtype -short | grep dev_usrName)
do
  ct lock -obsolete brtype:$b
done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://variedthoughts.com/programming/cleartool-obsolete-branches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: variedthoughts.com @ 2012-05-19 18:42:40 -->
