<?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>Dammit Jim!</title>
	<atom:link href="http://scott.sherrillmix.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://scott.sherrillmix.com/blog</link>
	<description>I'm a biologist not a...</description>
	<lastBuildDate>Fri, 11 Feb 2011 04:05:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Handy Apply-based R Progress Bars</title>
		<link>http://scott.sherrillmix.com/blog/programmer/handy-apply-based-r-progress-bars/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/handy-apply-based-r-progress-bars/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 05:09:05 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Programmer]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[apply]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[lapply]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[sapply]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/?p=550</guid>
		<description><![CDATA[In a funny congruence with my post on R progress bars, Mark Heckmann just posted about some wrappers for the apply functions in R. He wrote up some functions that imitate sapply, lapply and apply but automatically add a progress bar so you can monitor the progress. They work very nice since you can just [...]]]></description>
			<content:encoded><![CDATA[<p>In a funny congruence with my post on <a href="http://scott.sherrillmix.com/blog/programmer/progress-bars-in-r/">R progress bars</a>, Mark Heckmann just posted about some <a href="http://ryouready.wordpress.com/2010/01/11/progress-bars-in-r-part-ii-a-wrapper-for-apply-functions/">wrappers for the apply functions in R</a>. He wrote up some functions that imitate <code>sapply</code>, <code>lapply</code> and <code>apply</code> but automatically add a progress bar so you can monitor the progress. They work very nice since you can just substitute his <code>apply_pb</code>&#8216;s in place of R&#8217;s standard <code>apply</code>&#8216;s. He says it&#8217;s a bit of a performance drag but after testing a bit it looks like they really shouldn&#8217;t add much overhead at all if there&#8217;s any major calculations inside the loop. Very handy.</p>]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/handy-apply-based-r-progress-bars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Progress Bars in R</title>
		<link>http://scott.sherrillmix.com/blog/programmer/progress-bars-in-r/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/progress-bars-in-r/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 02:42:57 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Programmer]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[bar]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[progress]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/?p=544</guid>
		<description><![CDATA[Recently, I've had a lot of time consuming tasks running in R where it's nice to know how the computer is doing. I usually just output the name of the current iteration or a dot or something but I finally decided I should figure out how to make a nice progress bar in R. It [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I've had a lot of time consuming tasks running in R where it's nice to know how the computer is doing. I usually just output the name of the current iteration or a dot or something but I finally decided I should figure out how to make a nice progress bar in R. It turns out it's really simple since it's already builtin with the <code>txtProgressBar</code> function. So you can do something like:</p>
<div class="syntax_hilite"><span class="langName">R:</span><br /><div id="r-2">
<div class="r"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">numberSteps&lt;-<span style="color: #cc66cc;color:#800000;">10</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pb &lt;- txtProgressBar<span style="color: #66cc66;">&#40;</span>min = <span style="color: #cc66cc;color:#800000;">0</span>, max = numberSteps, style = <span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a020f0;">for</span><span style="color: #66cc66;">&#40;</span>i <span style="color: #a020f0;">in</span> <span style="color: #cc66cc;color:#800000;">1</span>:numberSteps<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; setTxtProgressBar<span style="color: #66cc66;">&#40;</span>pb, i<span style="color: #66cc66;">&#41;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; Sys.sleep<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">close<span style="color: #66cc66;">&#40;</span>pb<span style="color: #66cc66;">&#41;</span> </div></li></ol></div>
</div></div><br />
<img src="/res/images/progressBar.png" alt="A text progress bar in R" class="center"/>
<p>That's good enough for me but there's also <code>winProgressBar</code> for a fancy Windows progress bar and <code>tkProgressBar</code> (in the <code>tcltk</code> package) if you really want to get fancy.</p>

]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/progress-bars-in-r/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Syntax highlighting in terminal</title>
		<link>http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 04:53:09 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Bash/UNIX]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[pygmentize]]></category>
		<category><![CDATA[syntax highlighting]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/?p=526</guid>
		<description><![CDATA[I was just quickly flipping through code on a terminal and got to thinking that it would be pretty handy to be able to syntax highlight when using head or grep without having to open an editor. Luckily, I remembered Pygmentize was pretty handy when syntax highlighting in LaTeX so I wondered if they had [...]]]></description>
			<content:encoded><![CDATA[<img src="/res/images/ccat.png" alt="Syntax highlighted cat" class="right"/>
<p>I was just quickly flipping through code on a terminal and got to thinking that it would be pretty handy to be able to syntax highlight when using <code>head</code> or <code>grep</code> without having to open an editor. Luckily, I remembered <a href="http://pygments.org/">Pygmentize</a> was pretty handy when <a href="http://scott.sherrillmix.com/blog/programmer/displaying-code-in-latex/">syntax highlighting in LaTeX</a> so I wondered if they had an equivalent output for terminal. It turns out they do (in standard or 256 color no less) so in a couple minutes I had a really short script for highlighting code at the terminal saved it to <code>bin/ccat</code> and was ready to go. Pygmentize really is impressive. Here's the script if anyone else is looking to do the same:</p>
<div class="syntax_hilite"><span class="langName">BASH:</span><br /><div id="bash-4">
<div class="bash"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">#!/bin/bash#!/bin/bash</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> ! -t <span style="color: #cc66cc;color:#800000;">0</span> <span style="color: #66cc66;">&#93;</span>;then</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">file=</span>/dev/stdin</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">elif</span> <span style="color: #66cc66;">&#91;</span> -f $<span style="color: #cc66cc;color:#800000;">1</span> <span style="color: #66cc66;">&#93;</span>;then</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">file=</span>$<span style="color: #cc66cc;color:#800000;">1</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">"Usage: $0 code.c"</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">echo</span> <span style="color: #ff0000;">"or e.g. head code.c|$0"</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">exit</span> <span style="color: #cc66cc;color:#800000;">1</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">fi</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pygmentize -f terminal -g <span style="color: #0000ff;">$file</span> </div></li></ol></div>
</div></div><br />
<p>It just looks for stdin and if it doesn't find it it looks for a file name or takes direct input. Obviously it requires Pygmentize (which is really <a href="http://pygments.org/download/">easy to install</a> if you already have Python).</p>]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Happy (late) October 1st</title>
		<link>http://scott.sherrillmix.com/blog/tourist/happy-late-october-1st/</link>
		<comments>http://scott.sherrillmix.com/blog/tourist/happy-late-october-1st/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 00:28:31 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Tourist]]></category>
		<category><![CDATA[Beijing]]></category>
		<category><![CDATA[china]]></category>
		<category><![CDATA[National Day]]></category>
		<category><![CDATA[October 1st]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/?p=512</guid>
		<description><![CDATA[China just had their national day (called GuoQinJie I'm told) on October 1st. It was their 60th anniversary so there was a pretty big parade. Which is actually a bit frustrating since I was in Tienanmen Square last October 1st and there was nothing but a bunch of tourists milling around (the rest of the [...]]]></description>
			<content:encoded><![CDATA[<p>China just had their national day (called GuoQinJie I'm told) on October 1st. It was their 60th anniversary so there was a pretty big parade. Which is actually a bit frustrating since I was in Tienanmen Square last October 1st and there was nothing but a bunch of tourists milling around (the rest of the trip was great anyway so no big deal). Apparently if you're ever planning on visiting Beijing on National Day, you need to make sure it's in a year ending in 9 or 4. Anyway, my wife came across this pretty <a href="http://vimeo.com/6853452">cool time lapse video of the parade</a> (the video page has it in HD):</p>
<div class="center"><object class="right" width="400" height="225" type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=6853452&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1">
<param name="allowfullscreen" value="true"/>
<param name="allowscriptaccess" value="always" />
<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6853452&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /></object></div>]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/tourist/happy-late-october-1st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tab Indented Standard Input Redirect in Bash</title>
		<link>http://scott.sherrillmix.com/blog/programmer/tab-indented-standard-input-redirect-in-bash/</link>
		<comments>http://scott.sherrillmix.com/blog/programmer/tab-indented-standard-input-redirect-in-bash/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 02:52:43 +0000</pubDate>
		<dc:creator>ScottS-M</dc:creator>
				<category><![CDATA[Bash/UNIX]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[EOF]]></category>
		<category><![CDATA[indent]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[standard input]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://scott.sherrillmix.com/blog/?p=502</guid>
		<description><![CDATA[I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I'd make a note here so I don't forget again and for anyone else in the [...]]]></description>
			<content:encoded><![CDATA[<p>I managed to forget how to redirect standard input (when you want to feed a bunch of lines to a program) in a bash script while still indenting and had to go digging around for it. So I figured I'd make a note here so I don't forget again and for anyone else in the same boat. It's just <code>&lt;&lt;-</code> instead of <code>&lt;&lt;</code>. For example if you want to keep indentation within a loop:</p>
<div class="syntax_hilite"><span class="langName">BASH:</span><br /><div id="bash-6">
<div class="bash"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> i <span style="color: #b1b100;">in</span> <span style="color: #cc66cc;color:#800000;">1</span> <span style="color: #cc66cc;color:#800000;">2</span> <span style="color: #cc66cc;color:#800000;">3</span> <span style="color: #cc66cc;color:#800000;">4</span>;do</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; cat&lt;&lt;-EOF</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; This is loop <span style="color: #0000ff;">$i</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; More advanced stuff could go here</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; EOF</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">done</span> </div></li></ol></div>
</div></div><br />
<p>You can use whatever you want to indicate the end of the input instead of EOF if it floats your boat (as long as you use the same thing both times) but unfortunately <code>&lt;&lt;-</code> doesn't work with spaces for indentation (although I'm a tab man myself).</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.sherrillmix.com/blog/programmer/tab-indented-standard-input-redirect-in-bash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.233 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-03 20:42:07 -->

