<?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>idle thoughts</title>
	<atom:link href="http://rjpower.org/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://rjpower.org/wordpress</link>
	<description>Musings on distributed systems.</description>
	<lastBuildDate>Thu, 16 May 2013 21:00:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>thread profiling in Python</title>
		<link>http://rjpower.org/wordpress/thread-profiling-in-python/</link>
		<comments>http://rjpower.org/wordpress/thread-profiling-in-python/#comments</comments>
		<pubDate>Thu, 16 May 2013 17:49:24 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=386</guid>
		<description><![CDATA[Python has accumulated a lot of&#8230; character over the years.  We&#8217;ve got no less then 3 profiling libraries for single threaded execution and a multi-threaded profiler with an incompatible interface (Yappi).  Since many applications use more then one thread, this can &#8230; <a href="http://rjpower.org/wordpress/thread-profiling-in-python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Python has accumulated a lot of&#8230; <em>character</em> over the years.  We&#8217;ve got no less then 3 profiling libraries for single threaded execution and a multi-threaded profiler with an incompatible interface (<a href="https://code.google.com/p/yappi/">Yappi</a>).  Since many applications use more then one thread, this can be a bit annoying.</p>
<p>Yappi works most of the time.  Except, sometimes it doesn&#8217;t, and randomly causes your application to hang.  (I blame <a href="http://en.wikipedia.org/wiki/Unix_signal">signals</a>, personally).  The other issue is that Yappi doesn&#8217;t have a way of collecting call-stack information. (I don&#8217;t necessarily care that memcpy takes all of the time, I want to know who called memcpy).  In particular, the lovely <a href="https://code.google.com/p/jrfonseca/wiki/Gprof2Dot">gprof2dot</a> can take in pstats dumps and output a very nice profile graph.</p>
<p>To address this for my uses, I glom together cProfile runs from multiple threads.  In case it might be useful for other people I wrote a quick gist illustrating how to do it.  To make it easy to drop in, I monkey-patch the Thread.run method, but you can use a more maintainable approach if you like (I create a subclass ProfileThread in my applications).</p>
<script src="https://gist.github.com/5593567.js"></script><noscript><p>View the code on <a href="https://gist.github.com/5593567">Gist</a>.</p></noscript>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/thread-profiling-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swig+Directors = Subclassing from Python!</title>
		<link>http://rjpower.org/wordpress/swigdirectors-subclassing-from-python/</link>
		<comments>http://rjpower.org/wordpress/swigdirectors-subclassing-from-python/#comments</comments>
		<pubDate>Tue, 07 May 2013 15:26:06 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=376</guid>
		<description><![CDATA[Swig is a fabulous tool &#8212; I generally rely on it to extricate myself from the holes I&#8217;ve managed to dig myself into using C++.  Swig parses C++ code and generates wrappers for a whole bunch of target languages &#8212; I &#8230; <a href="http://rjpower.org/wordpress/swigdirectors-subclassing-from-python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://swig.org">Swig</a> is a fabulous tool &#8212; I generally rely on it to extricate myself from the holes I&#8217;ve managed to dig myself into using C++.  Swig parses C++ code and generates wrappers for a whole bunch of target languages &#8212; I normally use it to build Python interfaces to my C++ code.</p>
<p>A cool feature that I&#8217;ve never made use of before is &#8220;directors&#8221; &#8212; these let you write subclasses for your C++ code in Python/(whatever language use desire).  In particular, this provides a relatively easy mechanism for writing callbacks using Python.  Here&#8217;s a quick example:</p>
<pre>
// rpc.h
class RPCHandler {
public:
void fire(const Request&amp;, Response*) = 0;
}

class RPC {
public:
void register_handler(const std::string&amp; name, RPCHandler*);
};
</pre>
<p>Normally, I&#8217;d make a subclass of RPCHandler in C++ and register it with my RPC server.  But with SWIG, I can actually write this using Python:</p>
<pre>
class MyHandler(wrap.RPCHandler):
  def fire(req, resp):
    resp.write('Hello world!')
</pre>
<p>It&#8217;s relatively straightforward to setup.  I write an interface file describing my application:</p>
<pre>
// wrap.swig
// Our output module will be called 'wrap'; enable director support.
%module(directors="1") wrap
%feature("director") RPCHandler;

// Generate wrappers for our RPC code
%include "rpc.h"

// When compiling the wrapper code, include our original header.
%{
#include "rpc.h"
%}
</pre>
<p>That&#8217;s it!  Now we can run swig: <code> swig -c++ -python -O -o wrap.cc wrap.swig </code></p>
<p>Swig will generate wrap.cc (which we compile and link into our application), and a wrap.py file, which we can use from Python.</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/swigdirectors-subclassing-from-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ah, latex</title>
		<link>http://rjpower.org/wordpress/ah-latex/</link>
		<comments>http://rjpower.org/wordpress/ah-latex/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 14:19:49 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=368</guid>
		<description><![CDATA[I thought I wanted to customize the layout of my document a little bit, so I started looking at the various styles that are available. Then I came upon the memoir package (which is supposed to help with these things); &#8230; <a href="http://rjpower.org/wordpress/ah-latex/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I thought I wanted to customize the layout of my document a little bit, so I started looking at the various styles that are available.</p>
<p>Then I came upon the <a href="http://www.math.washington.edu/tex-archive/macros/latex/contrib/memoir/memman.pdf">memoir</a> package (which is supposed to help with these things); the 550 page manual that comes with it has so effectively scared the crap out of me that I&#8217;m now looking at my crappy looking document and thinking: &#8220;heck, it looks good enough&#8221;.</p>
<p>I will gladly leave typography to the typographers.</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/ah-latex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vim</title>
		<link>http://rjpower.org/wordpress/vim/</link>
		<comments>http://rjpower.org/wordpress/vim/#comments</comments>
		<pubDate>Tue, 26 Mar 2013 12:35:23 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=363</guid>
		<description><![CDATA[I&#8217;m a frequent (some might say avid) user of the Vim text editor. I&#8217;ve been using it off and on for the past 15 years, and it&#8217;s frequently saved me quite a bit of time with the handy macro system. &#8230; <a href="http://rjpower.org/wordpress/vim/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m a frequent (some might say avid) user of the <a href="http://vim.org">Vim</a> text editor.  I&#8217;ve been using it off and on for the past 15 years, and it&#8217;s frequently saved me quite a bit of time with the handy macro system.</p>
<p>Now, if you&#8217;ve ever used Vim before you&#8217;re probably familiar with this intro screen:</p>
<p><img src="http://rjpower.org/wordpress/wp-content/uploads/2013/03/vim.png" alt="vim" width="566" height="601" class="alignnone size-full wp-image-364" /></p>
<p>Somehow, amazingly, and I&#8217;m sure like everyone else, I had managed to go on for all this time without really ever typing <code>:help uganda</code>.  Last night, while installing Vim on my new laptop, I finally did.  I saw Bram&#8217;s <a href="http://www.iccf.nl/news.html">visit report</a>.  I was really touched at how much they were doing with <a href="http://iccf.nl/jaarrekening2012en.pdf">relatively limited resources</a>.  And so I finally made a small donation to ICCF; I even got a personal email from Bram in reply, which was nice.</p>
<p>Anyway, if you&#8217;re a Vim user, I encourage you to do the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>kde desktop magic</title>
		<link>http://rjpower.org/wordpress/kde-desktop-magic/</link>
		<comments>http://rjpower.org/wordpress/kde-desktop-magic/#comments</comments>
		<pubDate>Fri, 22 Mar 2013 16:47:12 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=359</guid>
		<description><![CDATA[Something miraculous that I just realized: middle clicking (aka pasting the X buffer) on the KDE desktop creates a &#8220;post-it&#8221; note with the contents of the clipboard. Whether I will ever make use of this feature is unclear but it&#8217;s &#8230; <a href="http://rjpower.org/wordpress/kde-desktop-magic/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Something miraculous that I just realized: middle clicking (aka pasting the X buffer) on the KDE desktop creates a &#8220;post-it&#8221; note with the contents of the clipboard.</p>
<p>Whether I will ever make use of this feature is unclear but it&#8217;s definitely the &#8220;right&#8221; behavior and a nice thought on the developers part.</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/kde-desktop-magic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big Gummy Bears</title>
		<link>http://rjpower.org/wordpress/big-gummy-bears/</link>
		<comments>http://rjpower.org/wordpress/big-gummy-bears/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 13:21:53 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=346</guid>
		<description><![CDATA[Normally, when confronted with (inevitably weird and annoying) YouTube commercials, I&#8217;m hovering over the &#8220;Skip Ad&#8221; link, waiting for it to be enabled. But today, I saw an advertisement so odd, that I was forced to watch through the whole &#8230; <a href="http://rjpower.org/wordpress/big-gummy-bears/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Normally, when confronted with (inevitably weird and annoying) YouTube commercials, I&#8217;m hovering over the &#8220;Skip Ad&#8221; link, waiting for it to be enabled.</p>
<p>But today, I saw an advertisement so odd, that I was forced to watch through the whole thing just to figure out if it was a parody.  It wasn&#8217;t.  Congratulations Vat19, on a successful commercial &#8211; if I&#8217;m ever in the market for <a href="http://www.vat19.com/dvds/worlds-largest-gummy-bear.cfm">giant gummy bears</a>, I&#8217;ll come your way.</p>
<p>Who thinks up these things?</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/big-gummy-bears/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fiber to the people</title>
		<link>http://rjpower.org/wordpress/fiber-to-the-people/</link>
		<comments>http://rjpower.org/wordpress/fiber-to-the-people/#comments</comments>
		<pubDate>Fri, 22 Feb 2013 15:32:54 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=343</guid>
		<description><![CDATA[My home internet sucks, relatively speaking. Anytime something shows up as &#8220;HD&#8221;, I know that it&#8217;s not going to work out for me. This is not at all surprising, given that I only have one choice (Time Warner) and they &#8230; <a href="http://rjpower.org/wordpress/fiber-to-the-people/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>My home internet sucks, relatively speaking.  Anytime something shows up as &#8220;HD&#8221;, I know that it&#8217;s not going to work out for me.  This is not at all surprising, given that I only have one choice (Time Warner) and they continually send me advertisements offering to spend $100 a month in order to get the bandwidth I&#8217;m supposed to get for $50.  The sad thing is that if you look at the wireless routers visible from my apartment (> 50), everyone in the building (and nearby buildings) has the same problem.  If only we could just share one <em>good</em> connection, we&#8217;d all be so much happier.</p>
<p>So here&#8217;s what I think should happen.</p>
<p>Apartment buildings should have fiber run to the building, run ethernet/wireless to each floor, and charge $40 a month to access it.  Why?  Because they&#8217;d make money off of it, that&#8217;s why.  After the initial cost to run the fiber, they could contract with Cogent/Level 3/ATT to provide transit.  Based on my crude knowledge of the state of connection costs from 5 years ago, it would cost about $5 a month to give every user 10Mb/s of dedicated service.</p>
<p>And everyone in the building would get 10 times the bandwidth of Time Warner to boot.  Hurray!</p>
<p>I&#8217;ve been daydreaming about starting a company that contracts to do just this (drag fiber to buildings and contract for support).  I know, I know, a lot of this types of companies already exist, but still&#8230; let me daydream.</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/fiber-to-the-people/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a bit of fall</title>
		<link>http://rjpower.org/wordpress/a-bit-of-fall/</link>
		<comments>http://rjpower.org/wordpress/a-bit-of-fall/#comments</comments>
		<pubDate>Tue, 12 Feb 2013 14:42:19 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=334</guid>
		<description><![CDATA[Since it&#8217;s still ugly out, how about some pretty leaves that I found on my cellphone camera&#8230;]]></description>
				<content:encoded><![CDATA[<p>Since it&#8217;s still ugly out, how about some pretty leaves that I found on my cellphone camera&#8230;</p>
<p><a href="http://rjpower.org/wordpress/a-bit-of-fall/2012-10-20_13-53-44_72/" rel="attachment wp-att-335"><img src="http://rjpower.org/wordpress/wp-content/uploads/2013/02/2012-10-20_13-53-44_72-1024x576.jpg" alt="2012-10-20_13-53-44_72" width="800" height="450" class="alignnone size-large wp-image-335" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/a-bit-of-fall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tesla GPU not showing up for cudaDeviceCount/getDevice</title>
		<link>http://rjpower.org/wordpress/tesla-gpu-not-showing-up-for-cudadevicecountgetdevice/</link>
		<comments>http://rjpower.org/wordpress/tesla-gpu-not-showing-up-for-cudadevicecountgetdevice/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 23:00:16 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=333</guid>
		<description><![CDATA[I spent a few hours today debugging this &#8212; GPU programming is its own special form of hell. It turns out I had to disable ECC and reset the GPU: nvidia-smi -i 1 -e 0 nvidia-smi -i 1 -r Naturally, &#8230; <a href="http://rjpower.org/wordpress/tesla-gpu-not-showing-up-for-cudadevicecountgetdevice/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I spent a few hours today debugging this &#8212; GPU programming is its own special form of hell.  It turns out I had to disable ECC and reset the GPU:</p>
<pre><code>nvidia-smi -i 1 -e 0
nvidia-smi -i 1 -r
</code></pre>
<p>Naturally, there was no indication of an ECC error having occurred, and just resetting the GPU&#8217;s doesn&#8217;t help matters.</p>
<p>Sigh.</p>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/tesla-gpu-not-showing-up-for-cudadevicecountgetdevice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>why couldn&#8217;t john kerry be like this when he was running for president?</title>
		<link>http://rjpower.org/wordpress/why-couldnt-john-kerry-be-like-this-when-he-was-running-for-president/</link>
		<comments>http://rjpower.org/wordpress/why-couldnt-john-kerry-be-like-this-when-he-was-running-for-president/#comments</comments>
		<pubDate>Thu, 10 Jan 2013 14:15:25 +0000</pubDate>
		<dc:creator>power</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rjpower.org/wordpress/?p=329</guid>
		<description><![CDATA[Sigh. The John Kerry post-2008 is just so much more relaxed and entertaining. I&#8217;d vote for him. (Admittedly, I voted for him in 2008 as well). How to Beat Jet Lag: Forget About It (John Kerry) I can&#8217;t say my &#8230; <a href="http://rjpower.org/wordpress/why-couldnt-john-kerry-be-like-this-when-he-was-running-for-president/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Sigh. The John Kerry post-2008 is just so much more relaxed and entertaining. I&#8217;d vote for him. (Admittedly, I voted for him in 2008 as well).</p>
<p><a href="http://www.mensjournal.com/health-fitness/health/how-to-beat-jet-lag-forget-about-it-john-kerry-20130108">How to Beat Jet Lag: Forget About It (John Kerry)</a></p>
<blockquote>
<p>I can&#8217;t say my past experiments with jet lag remedies have been very scientific. When I&#8217;m flying, I usually take an Ambien and listen to one of my own speeches on my iPod. I&#8217;m out in seconds. But it doesn&#8217;t always work, and sometimes you&#8217;ll have some funny moments from being overtired. There was an incident in New Orleans, at Mardi Gras, in 1997. But the video has been destroyed and I gave the beads back.&#8221;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://rjpower.org/wordpress/why-couldnt-john-kerry-be-like-this-when-he-was-running-for-president/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
