
<?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>New Bright Idea</title>
	<atom:link href="http://newbrightidea.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://newbrightidea.com</link>
	<description>peripatetic creativity</description>
	<lastBuildDate>Thu, 26 Apr 2012 19:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Simple Pulse Animation with jQuery</title>
		<link>http://newbrightidea.com/2012/04/26/simple-pulse-animation-with-jquery/</link>
		<comments>http://newbrightidea.com/2012/04/26/simple-pulse-animation-with-jquery/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 19:06:26 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=211</guid>
		<description><![CDATA[The simplest way that I could think of to implement a &#8220;pulse&#8221; effect in jQuery. I know there are plugins that will do this. Not sure that any of them will do it in 12 lines of code. I use &#8230; <a href="http://newbrightidea.com/2012/04/26/simple-pulse-animation-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The simplest way that I could think of to implement a &#8220;pulse&#8221; effect in jQuery.  I know there are plugins that will do this.  Not sure that any of them will do it in 12 lines of code.<br />
<div id="gist-2502006" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">function</span> <span class="nx">pulse</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">duration</span><span class="p">,</span> <span class="nx">easing</span><span class="p">,</span> <span class="nx">props_to</span><span class="p">,</span> <span class="nx">props_from</span><span class="p">,</span> <span class="nx">until</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">elem</span><span class="p">.</span><span class="nx">animate</span><span class="p">(</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">props_to</span><span class="p">,</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">duration</span><span class="p">,</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">easing</span><span class="p">,</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span> <span class="nx">until</span><span class="p">()</span> <span class="o">==</span> <span class="kc">false</span> <span class="p">)</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">pulse</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">duration</span><span class="p">,</span> <span class="nx">easing</span><span class="p">,</span> <span class="nx">props_from</span><span class="p">,</span> <span class="nx">props_to</span><span class="p">,</span> <span class="nx">until</span><span class="p">);</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC13'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2502006/a0f219116b3ce544c107ae493b16d4482b1c0134/jquery-pulse.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2502006#file_jquery_pulse.js" style="float:right;margin-right:10px;color:#666">jquery-pulse.js</a>
            <a href="https://gist.github.com/2502006">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
I use it to animate an HTML5 drag-and-drop target, wired up to the <code>dragenter</code> event like this:<br />
<div id="gist-2502030" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">function</span> <span class="nx">drop_target_enter</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">$dt</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">target_id</span><span class="p">)</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">$dt</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="s1">&#39;dt-entered&#39;</span><span class="p">);</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">pulse</span><span class="p">(</span><span class="nx">$dt</span><span class="p">,</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="mi">500</span><span class="p">,</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;linear&#39;</span><span class="p">,</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span><span class="nx">opacity</span><span class="o">:</span> <span class="mf">0.25</span><span class="p">},</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span><span class="nx">opacity</span><span class="o">:</span> <span class="mi">1</span><span class="p">},</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nx">$dt</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="s1">&#39;dt-entered&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">});</span></div><div class='line' id='LC12'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2502030/6bd9378a97d7cb4f54c47510c224b2dbd4737299/drag-enter.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2502030#file_drag_enter.js" style="float:right;margin-right:10px;color:#666">drag-enter.js</a>
            <a href="https://gist.github.com/2502030">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2012/04/26/simple-pulse-animation-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting compiler options with SBT</title>
		<link>http://newbrightidea.com/2012/04/11/setting-compiler-options-with-sbt/</link>
		<comments>http://newbrightidea.com/2012/04/11/setting-compiler-options-with-sbt/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 23:32:53 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=204</guid>
		<description><![CDATA[There&#8217;s a lot of misinformation out there re. how to set javac and scalac compiler options in sbt. You might see stuff about defining a custom Build object in a .scala file. Or a custom Project object. It&#8217;s all nonsense. &#8230; <a href="http://newbrightidea.com/2012/04/11/setting-compiler-options-with-sbt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a lot of misinformation out there re. how to set <code>javac</code> and <code>scalac</code> compiler options in <a href="https://github.com/harrah/xsbt">sbt</a>.  You might see stuff about defining a custom Build object in a .scala file.  Or a custom Project object.  It&#8217;s all nonsense.  I guess it applies to previous versions of sbt.  In sbt 0.11.2, you set <code>javac</code> and <code>scalac</code> compiler options as shown on the <a href="https://github.com/harrah/xsbt/wiki/Quick-Configuration-Examples">sbt examples page here</a>:</p>
<div id="gist-2363470" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>name := &quot;TCP Server Build Configuration&quot;</div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>version := &quot;0.1.0&quot;</div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>scalaVersion := &quot;2.9.1&quot;</div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'>javacOptions ++= Seq(&quot;-Xlint:unchecked&quot;)</div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'>scalacOptions ++= Seq(&quot;-unchecked&quot;, &quot;-deprecation&quot;)</div><div class='line' id='LC10'><br/></div><div class='line' id='LC11'>resolvers += &quot;Typesafe Repository&quot; at &quot;http://repo.typesafe.com/typesafe/releases/&quot;</div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'>libraryDependencies += &quot;com.typesafe.akka&quot; % &quot;akka-actor&quot; % &quot;2.0&quot;</div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>libraryDependencies += &quot;com.mongodb.casbah&quot; % &quot;casbah_2.9.0-1&quot; % &quot;2.1.5.0&quot;</div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2363470/5b9bd5aa0fc61bf27dda126a8779fdaf8e50bd1e/gistfile1.txt" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2363470#file_gistfile1.txt" style="float:right;margin-right:10px;color:#666">gistfile1.txt</a>
            <a href="https://gist.github.com/2363470">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2012/04/11/setting-compiler-options-with-sbt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trivial Non-Blocking Echo Server (Scala+Akka)</title>
		<link>http://newbrightidea.com/2012/03/27/trivial-non-blocking-echo-server-scalaakka/</link>
		<comments>http://newbrightidea.com/2012/03/27/trivial-non-blocking-echo-server-scalaakka/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 19:43:36 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=196</guid>
		<description><![CDATA[Akka is a framework for asynchronous messaging and IO in Scala. A colleague of mine gave it a good recommendation so I thought I&#8217;d check it out. It looks very promising although its low-level IO API is not as intuitive &#8230; <a href="http://newbrightidea.com/2012/03/27/trivial-non-blocking-echo-server-scalaakka/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://akka.io">Akka</a> is a framework for asynchronous messaging and IO in <a href="http://scala-lang.org">Scala</a>. A colleague of mine gave it a good recommendation so I thought I&#8217;d check it out. It looks very promising although its low-level IO API is not as intuitive as I&#8217;d hoped. But, it was very easy to build a simple echo server, the &#8220;Hello, World!&#8221; of network programming.</p>
<p>Of course, it&#8217;s pretty easy to build a <strong>blocking</strong> socket server in pretty much any language.  What I love about Scala+Akka is how easy it is to hide the fact that all of this IO is non-blocking.</p>
<p><div id="gist-2219531" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">import</span> <span class="nn">akka.actor._</span></div><div class='line' id='LC2'><span class="k">import</span> <span class="nn">java.net.InetSocketAddress</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="k">class</span> <span class="nc">TCPServer</span><span class="o">(</span><span class="n">port</span><span class="k">:</span> <span class="kt">Int</span><span class="o">)</span> <span class="k">extends</span> <span class="nc">Actor</span> <span class="o">{</span></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'>&nbsp;&nbsp;<span class="k">override</span> <span class="k">def</span> <span class="n">preStart</span> <span class="o">{</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nc">IOManager</span><span class="o">(</span><span class="n">context</span><span class="o">.</span><span class="n">system</span><span class="o">)</span> <span class="n">listen</span> <span class="k">new</span> <span class="nc">InetSocketAddress</span><span class="o">(</span><span class="n">port</span><span class="o">)</span></div><div class='line' id='LC8'>&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'>&nbsp;&nbsp;<span class="k">def</span> <span class="n">receive</span> <span class="k">=</span> <span class="o">{</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="nc">IO</span><span class="o">.</span><span class="nc">NewClient</span><span class="o">(</span><span class="n">server</span><span class="o">)</span> <span class="k">=&gt;</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">server</span><span class="o">.</span><span class="n">accept</span><span class="o">()</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="nc">IO</span><span class="o">.</span><span class="nc">Read</span><span class="o">(</span><span class="n">rHandle</span><span class="o">,</span> <span class="n">bytes</span><span class="o">)</span> <span class="k">=&gt;</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">rHandle</span><span class="o">.</span><span class="n">asSocket</span> <span class="n">write</span> <span class="n">bytes</span><span class="o">.</span><span class="n">compact</span></div><div class='line' id='LC15'>&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC16'><span class="o">}</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="k">object</span> <span class="nc">TCPServer</span> <span class="k">extends</span> <span class="nc">App</span></div><div class='line' id='LC19'><span class="o">{</span></div><div class='line' id='LC20'>&nbsp;&nbsp;<span class="k">val</span> <span class="n">port</span> <span class="k">=</span> <span class="nc">Option</span><span class="o">(</span><span class="nc">System</span><span class="o">.</span><span class="n">getenv</span><span class="o">(</span><span class="s">&quot;PORT&quot;</span><span class="o">))</span> <span class="n">map</span> <span class="o">(</span><span class="k">_</span><span class="o">.</span><span class="n">toInt</span><span class="o">)</span> <span class="n">getOrElse</span> <span class="mi">8080</span></div><div class='line' id='LC21'>&nbsp;&nbsp;<span class="nc">ActorSystem</span><span class="o">().</span><span class="n">actorOf</span><span class="o">(</span><span class="nc">Props</span><span class="o">(</span><span class="k">new</span> <span class="nc">TCPServer</span><span class="o">(</span><span class="n">port</span><span class="o">)))</span>			</div><div class='line' id='LC22'><span class="o">}</span></div><div class='line' id='LC23'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2219531/f3f92bd0b9e4728ab6a009b3ee2371c7ce8bff24/TcpServer.scala" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2219531#file_tcp_server.scala" style="float:right;margin-right:10px;color:#666">TcpServer.scala</a>
            <a href="https://gist.github.com/2219531">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
To run:<br />
<code><br />
scala -cp .:/home/rweeks/projects/akka-2.0/lib/akka/akka-actor-2.0.jar TCPServer<br />
</code><br />
To test:<br />
<code><br />
rweeks@foxbat:~/projects/scala-test$ telnet localhost 8080<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
You go first.<br />
You go first.<br />
No, You go first!<br />
No, You go first!<br />
Bye<br />
Bye<br />
^]<br />
telnet> close<br />
Connection closed.<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2012/03/27/trivial-non-blocking-echo-server-scalaakka/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>libmicrohttpd mingw gotcha</title>
		<link>http://newbrightidea.com/2012/03/13/libmicrohttpd-mingw-gotcha/</link>
		<comments>http://newbrightidea.com/2012/03/13/libmicrohttpd-mingw-gotcha/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 18:14:36 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=187</guid>
		<description><![CDATA[Let&#8217;s say you want to build a nice tiny cross-platform web server using libmicrohttpd and mingw.  So for static content you&#8217;ll probably convert the URI to a path (safely! watch out for nasty clients playing tricks with &#8220;../&#8221;) and call &#8230; <a href="http://newbrightidea.com/2012/03/13/libmicrohttpd-mingw-gotcha/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you want to build a nice tiny cross-platform web server using libmicrohttpd and mingw.  So for static content you&#8217;ll probably convert the URI to a path (safely! watch out for nasty clients playing tricks with &#8220;../&#8221;) and call open(3) on the path, and call MHD_create_response_from_fd with the file descriptor.</p>
<p>Sounds good, except on Windows you&#8217;ll see some very crazy errors whereby you actually read past the end of the file.  This is because Windows may decide to open the file as a text document, which will convert all your newlines to newlines + carriage returns.</p>
<p>The fix is to add the &#8220;O_BINARY&#8221; option to the open(3) call.  So,</p>
<div id="gist-2030342" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cp">#ifndef _WIN32</span></div><div class='line' id='LC2'><span class="cp">#define O_BINARY 0</span></div><div class='line' id='LC3'><span class="cp">#endif</span></div><div class='line' id='LC4'><span class="kt">int</span> <span class="n">fd</span> <span class="o">=</span> <span class="n">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">O_RDONLY</span> <span class="o">|</span> <span class="n">O_BINARY</span><span class="p">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2030342/33c88062b99801d6130e0c731808cfaa1b234b90/gistfile1.c" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2030342#file_gistfile1.c" style="float:right;margin-right:10px;color:#666">gistfile1.c</a>
            <a href="https://gist.github.com/2030342">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2012/03/13/libmicrohttpd-mingw-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slow iTunes Downloads on TELUS Optik</title>
		<link>http://newbrightidea.com/2012/01/06/slow-itunes-downloads-on-telus-optik/</link>
		<comments>http://newbrightidea.com/2012/01/06/slow-itunes-downloads-on-telus-optik/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 07:28:51 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=184</guid>
		<description><![CDATA[If you&#8217;re experiencing really slow downloads from the iTunes store on TELUS Optik, it could be a problem with your DNS servers.  I think by default the DHCP server on the Optik router configures the clients to use the router &#8230; <a href="http://newbrightidea.com/2012/01/06/slow-itunes-downloads-on-telus-optik/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re experiencing really slow downloads from the iTunes store on TELUS Optik, it could be a problem with your DNS servers.  I think by default the DHCP server on the Optik router configures the clients to use the router as their DNS server.  The router is configured to use the servers:</p>
<ul>
<li>75.153.176.1  (ns1.dns.telus.com)</li>
<li>75.153.176.9 (ns2.dns.telus.com)</li>
</ul>
<p>I think that either the Optik router or the TELUS DNS servers are a bottleneck here.  I guess  that for some reason, iTunes needs to do a lot of DNS lookups when it transfers data?</p>
<p>Anyways I changed my clients to use the following DNS servers:</p>
<ul>
<li>8.8.8.8</li>
<li>8.8.4.4</li>
<li>208.67.222.222</li>
<li>208.67.220.220</li>
</ul>
<p>The first two are provided by Google, the last two are provided by OpenDNS.  iTunes download speed went from ~200KB/sec to ~1.5MB/sec.  On Mac OS X, change the setting in System Preferences → Network → (Select your Network Connection) → Advanced → DNS.</p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2012/01/06/slow-itunes-downloads-on-telus-optik/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Corporate (Mis?)Management</title>
		<link>http://newbrightidea.com/2011/12/29/corporate-mismanagement/</link>
		<comments>http://newbrightidea.com/2011/12/29/corporate-mismanagement/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 02:36:56 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=178</guid>
		<description><![CDATA[Via Gruber, an article about the business anti-pattern of maximizing shareholder value.  I don&#8217;t disagree in principle with the idea that CEOs should have better things to do than negotiate expectations with market analysts.  But I think that the article&#8217;s &#8230; <a href="http://newbrightidea.com/2011/12/29/corporate-mismanagement/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Via <a title="Daring Fireball: Shareholder Value" href="http://daringfireball.net/linked/2011/12/28/shareholder-value" target="_blank">Gruber</a>, an article about the <a title="Forbes: Fixing the Game" href="http://www.forbes.com/sites/stevedenning/2011/11/28/maximizing-shareholder-value-the-dumbest-idea-in-the-world/" target="_blank">business anti-pattern of maximizing shareholder value</a>.  I don&#8217;t disagree in principle with the idea that CEOs should have better things to do than negotiate expectations with market analysts.  But I think that the article&#8217;s central analogy, that of a CEO to a football coach and a business to a football match, is fundamentally invalid.</p>
<p>A football match is time-bound.  This rightly requires that a football coach focus on winning the game in the required timeframe, not on beating the spread.  I can&#8217;t think of any type of business that&#8217;s similarly time-bound (in fact, I think a competent economist could argue that in an efficient market, all corporations are <a title="Lean Startup" href="http://theleanstartup.com/" target="_blank">growth-bound</a>).  In an environment that isn&#8217;t time-bound, it makes sense that the best metric of a corporation&#8217;s value is not its position or &#8220;score&#8221;, but the first and second derivatives of its position (that is, velocity and acceleration).  And isn&#8217;t this what market analysts are really getting at when they try to define expectations for a corporation?</p>
<p>Bonus amateur economist theorizing: there&#8217;s been a lot of talk lately about executive pay and the perverse incentives it creates.  For what it&#8217;s worth, I think the best rationalization of executive pay comes from tournament theory applied to the workplace.  This is probably best explained by Tim Harford in various places, including this <a title="Logic of Life: Executive Pay" href="http://www.youtube.com/watch?v=FZUqb5U_vSs" target="_blank">YouTube video from the Logic of Life</a>.  To summarize: lavish CEO pay is not only a reward for the CEO&#8217;s labour, it&#8217;s an incentive for his underlings to aspire to the top position.  This creates its own set of perverse incentives, prioritizing individual success over the success of the corporation.</p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2011/12/29/corporate-mismanagement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed RTree, added Graham&#8217;s Scan</title>
		<link>http://newbrightidea.com/2011/09/25/fixed-rtree-added-grahams-scan/</link>
		<comments>http://newbrightidea.com/2011/09/25/fixed-rtree-added-grahams-scan/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 22:12:11 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=171</guid>
		<description><![CDATA[I just updated my Util package on github, which is just a place where I keep various odds and ends.  The RTree implementation was broken in a bunch of ways: thanks to Fred Long, Simon Probst and 屈伟 for contributing fixes. &#8230; <a href="http://newbrightidea.com/2011/09/25/fixed-rtree-added-grahams-scan/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just updated my <a href="https://github.com/rweeks/util">Util package on github</a>, which is just a place where I keep various odds and ends.  The RTree implementation was broken in a bunch of ways: thanks to Fred Long, Simon Probst and 屈伟 for contributing fixes.</p>
<p>I also added a Java implementation of <a href="http://en.wikipedia.org/wiki/Graham_scan">Graham&#8217;s Scan</a> to find the convex hull of a 2-D coordinate set.</p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2011/09/25/fixed-rtree-added-grahams-scan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse jUnit Huh?</title>
		<link>http://newbrightidea.com/2011/09/24/eclipse-junit-huh/</link>
		<comments>http://newbrightidea.com/2011/09/24/eclipse-junit-huh/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 04:55:32 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=163</guid>
		<description><![CDATA[Eclipse!  You done me wrong!  Why on earth, when you recognize a Run Configuration as a jUnit test suite, would you not enable assertions by default?!?]]></description>
			<content:encoded><![CDATA[<p><a href="http://eclipse.org">Eclipse</a>!  You done me wrong!  Why on earth, when you recognize a Run Configuration as a jUnit test suite, would you <span style="text-decoration: underline;"><strong>not</strong></span> enable assertions by default?!?</p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2011/09/24/eclipse-junit-huh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking the Touchpad, Part 1</title>
		<link>http://newbrightidea.com/2011/08/26/hacking-the-touchpad-part-1/</link>
		<comments>http://newbrightidea.com/2011/08/26/hacking-the-touchpad-part-1/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 08:50:16 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=149</guid>
		<description><![CDATA[I just picked up a discounted HP TouchPad from my man Greg Chan (via a real stand-up guy who would probably prefer to remain anonymous).   Haven&#8217;t even played around with WebOS; it doesn&#8217;t interest me in the slightest.  We &#8230; <a href="http://newbrightidea.com/2011/08/26/hacking-the-touchpad-part-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just picked up a discounted HP TouchPad from my man <a href="http://50ftware.com/">Greg Chan</a> (via a real stand-up guy who would probably prefer to remain anonymous).   Haven&#8217;t even played around with WebOS; it doesn&#8217;t interest me in the slightest.  We need to get Android on this contraption!  Here are my modest contributions to the effort. First: an attempt to get an SSH client and server running.</p>
<h3>Preparing for the Worst</h3>
<p>First, establish a backup plan!  Once you register the device, you&#8217;ll have access to the <a href="https://ps.palmws.com/palmcsext/console/pages/LoginPage.iface">HP WebOS site</a>.  From there you can download WebOS Doctor, a Java app that will let you restore your TouchPad should something untoward happen to it.</p>
<p>I haven&#8217;t used WebOS Doctor yet and I hope I never have to.  But as a backup-backup plan, let&#8217;s make a copy of the filesystem.  Follow the instructions <a href="http://wiki.rootzwiki.com/index.php/HP_Touchpad">here</a> to get terminal (root) access to the TouchPad. After logging in, I ran this command:</p>
<pre>tar cvfz /media/internal/downloads/backup.tar.gz / --exclude '/media/internal/downloads/*</pre>
<p>to backup the filesystem.  It&#8217;s far from a perfect backup, and it may never be useful, but I like having it around just in case.  Let me know if you need a copy, it&#8217;s about 300MB.</p>
<h3>Setting up a Cross-Compiler</h3>
<p>Wow, setting up a cross compiler has gotten a lot easier since the last time I checked.  All I had to do was download the ARM cross-compiler from <a href="http://www.codesourcery.com/sgpp/lite/arm/portal/release1803">here</a> and install it.</p>
<p>The cross-compiler build tools are set up with weird names like &#8220;arm-none-linux-gnueabi-ar&#8221;.  There&#8217;s got to be an easier way to configure this but I just ran this command to set up shortened symlinks:</p>
<pre>rweeks@faithless:/bitsafe/CodeSourcery/Sourcery_G++_Lite/bin$ for CMD in *; do CMD_TRIM=`echo $CMD | sed -e 's/arm-none-linux-gnueabi-//'`; ln -s $CMD $CMD_TRIM; done</pre>
<p>Then you can control whether you&#8217;re using your native buildtools or the cross-compiler buildtools just by setting your $PATH.</p>
<h3>Building OpenSSH</h3>
<p>I figure a good first-day milestone is to get OpenSSH running on the TouchPad.  I&#8217;ll try to work my way up to a full-on Android distro <img src='http://newbrightidea.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  I pretty much followed the instructions <a href="http://www.unixwiz.net/techtips/openssh.html">here</a> with some minor changes for the cross-compiler.</p>
<p>First I defined a directory where I want to put all the build output:</p>
<pre>mkdir /bitsafe/arm-openssh-server/output</pre>
<p>The commands I used to build zLib:</p>
<pre>./configure --prefix=/bitsafe/arm-openssh-server/output</pre>
<pre>make &amp;&amp; make install</pre>
<p>The commands I used to build openSSL (this will take a while):</p>
<pre>./Configure --prefix=/bitsafe/arm-openssh-server/output linux-armv4</pre>
<pre>make &amp;&amp; make install</pre>
<p>The commands I used to build openSSH:</p>
<pre>./configure --host=arm-none-linux-gnueabi --prefix=/bitsafe/arm-openssh-server/output --with-zlib=$PWD/../zlib-1.2.5 --with-ssl-dir=../openssl-1.0.0d</pre>
<pre>make &amp;&amp; make install</pre>
<p>The OpenSSH build will fail to install due to the cross-compiler (it can&#8217;t strip the output files).  But that should be OK.</p>
<h3>Deploying OpenSSH to the TouchPad</h3>
<p>OK, everything should be built at this point.  You can double-check that you&#8217;re using the cross-compiler by, eg.</p>
<pre>find . -type f -print0 | xargs -0 file</pre>
<p>Where you see executable files, it should indicate that they have been built for the ARM architecture.  I wrapped up everything in a tarball:</p>
<pre>tar cvfz openssh-server.tar.gz arm-openssh-server/</pre>
<p>This grabbed my &#8220;output&#8221; directory, as well as the source directories for zLib, openSSL and openSSH (in case any files failed to install correctly into output/)</p>
<p>I had a vastly complicated procedure in mind to copy the tarball to my TouchPad, but it turns out that the TouchPad just mounts as a vfat file system which was mounted automatically by my build machine.  The whole thing was just a drag-and-drop, which was nice.</p>
<p>Extract the tar file like so:</p>
<pre>tar xvfz openssh-server.tar.gz --no-same-owner</pre>
<p>You&#8217;ll get a bunch of errors on the extraction because it can&#8217;t create symbolic links: I think this is because you&#8217;re extracting to a filesystem that doesn&#8217;t support symlinks.  No big deal.</p>
<p>Test that the cross-compiler worked!</p>
<pre>cd /media/internal/downloads/arm-openssh-server/zlib-1.2.5
./example
zlib version 1.2.5 = 0x1250, compile flags = 0x55
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!</pre>
<h3>Starting OpenSSH Server</h3>
<p>Harder than it sounds!  The root filesystem is mounted read-only by default, but you can hack your way around that with:</p>
<pre>mount -w -o remount /</pre>
<p>Then, add the sshd user and group to /etc/passwd and /etc/group</p>
<p>Setup an ssh key using ssh-keygen and set the &#8220;HostKey&#8221; property in sshd_config to point to the private key.</p>
<p>If you didn&#8217;t remount the root FS as read-write, you need to set UsePrivilegeSeparation to true.</p>
<p>Start sshd like so:</p>
<pre>root@RussHPTouchPad:/media/internal/downloads/arm-openssh-server/openssh-5.8p2# $PWD/sshd -f sshd_config -ddd</pre>
<p>(This is required because by setting up the &#8220;prefix&#8221; properties during the SSH build, all the commands will now be looking for their config in /bitsafe/&#8230;)</p>
<p>Last thing is to undo all the custom iptables config:</p>
<pre>iptables -F</pre>
<pre>iptables -P INPUT ACCEPT</pre>
<pre>iptables -X ALLOWED_PACKETS</pre>
<pre>iptables -X ICMPFLOOD</pre>
<pre>iptables -X INVALID_PACKETS</pre>
<h3>OpenSSH 5.8 Running on TouchPad:</h3>
<pre>backfire:bin rweeks$ ssh -p 2222 root@192.168.10.128
The authenticity of host '[192.168.10.128]:2222 ([192.168.10.128]:2222)' can't be established.
RSA key fingerprint is de:c2:1f:6a:30:e9:33:cc:85:f6:28:07:62:f9:8b:9b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.10.128]:2222' (RSA) to the list of known hosts.
root@192.168.10.128's password:
lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
debug1: permanently_set_uid: 0/0
Environment:
  USER=root
  LOGNAME=root
  HOME=/home/root
  PATH=/usr/bin:/bin:/usr/sbin:/sbin:/bitsafe/arm-openssh-server/output/bin
  MAIL=/var/mail/root
  SHELL=/bin/sh
  TZ=:/var/luna/preferences/localtime
  SSH_CLIENT=192.168.10.107 52206 2222
  SSH_CONNECTION=192.168.10.107 52206 192.168.10.128 2222
  SSH_TTY=/dev/pts/1
  TERM=xterm-color
root@RussHPTouchPad:/var/home/root#</pre>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2011/08/26/hacking-the-touchpad-part-1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>RTree implementation in Java</title>
		<link>http://newbrightidea.com/2011/01/24/rtree-implementation-in-java/</link>
		<comments>http://newbrightidea.com/2011/01/24/rtree-implementation-in-java/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 06:11:42 +0000</pubDate>
		<dc:creator>Russ Weeks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newbrightidea.com/?p=146</guid>
		<description><![CDATA[An RTree is a data structure for spatial indexing.  If you have a bunch of objects with associated coordinates (or associated rectangles, or hyperrectangles, etc.) you can use an RTree for queries like, &#8220;find all objects overlapping with this search &#8230; <a href="http://newbrightidea.com/2011/01/24/rtree-implementation-in-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>An RTree is a data structure for spatial indexing.  If you have a bunch of objects with associated coordinates (or associated rectangles, or hyperrectangles, etc.) you can use an RTree for queries like, &#8220;find all objects overlapping with this search rectangle&#8221; or &#8220;find the N closest objects to this object&#8221;.</p>
<p><a href="http://www-db.deis.unibo.it/courses/SI-LS/papers/Gut84.pdf">This</a> is the original paper describing the RTree and its implementation.  I&#8217;ve built a Java implementation based on it, <a href="https://github.com/rweeks/util">here</a>.</p>
<p>I used this RTree implementation to generate the simulated network topologies shown <a href="http://newbrightidea.com/?p=129">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://newbrightidea.com/2011/01/24/rtree-implementation-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

