<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Programming on traviscj/blog</title>
    <link>https://traviscj.com/blog/tags/programming/</link>
    <description>Recent content in Programming on traviscj/blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 15 Jun 2022 08:07:47 -0500</lastBuildDate>
    <atom:link href="https://traviscj.com/blog/tags/programming/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Transacter and Intent/Result</title>
      <link>https://traviscj.com/blog/post/2022-06-15-transacter-and-intent-result/</link>
      <pubDate>Wed, 15 Jun 2022 08:07:47 -0500</pubDate>
      <guid>https://traviscj.com/blog/post/2022-06-15-transacter-and-intent-result/</guid>
      <description>&lt;p&gt;At SQ, we had a family of &lt;code&gt;Transacter&lt;/code&gt; interfaces:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;interface&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Transacter&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;transaction&lt;/span&gt;(Function&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;Session, Void&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; session);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;interface&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Session&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    DSLContext &lt;span style=&#34;color:#a6e22e&#34;&gt;dsl&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;where &lt;code&gt;DSLContext&lt;/code&gt; is a &lt;a href=&#34;https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/DSLContext.html&#34;&gt;jOOQ concept&lt;/a&gt; &amp;amp; is the handle for doing work against the database.&#xA;Then this would be used in some class like&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;KvDao&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;@Inject&lt;/span&gt; Transacter transacter;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;put&lt;/span&gt;(String ns, String k, String v) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    transacter.&lt;span style=&#34;color:#a6e22e&#34;&gt;transaction&lt;/span&gt;(session &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        KvRecord record &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; KvRecord(ns, k, v);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        session.&lt;span style=&#34;color:#a6e22e&#34;&gt;dsl&lt;/span&gt;().&lt;span style=&#34;color:#a6e22e&#34;&gt;insertInto&lt;/span&gt;(KV).&lt;span style=&#34;color:#a6e22e&#34;&gt;set&lt;/span&gt;(record).&lt;span style=&#34;color:#a6e22e&#34;&gt;execute&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    });&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The parameters &lt;code&gt;ns&lt;/code&gt;, &lt;code&gt;k&lt;/code&gt;, and &lt;code&gt;v&lt;/code&gt; are shorthand for &lt;code&gt;namespace&lt;/code&gt;, &lt;code&gt;key&lt;/code&gt;, and &lt;code&gt;value&lt;/code&gt;, respectively.&#xA;We&amp;rsquo;ll show how these might be used together shortly!&lt;/p&gt;</description>
    </item>
    <item>
      <title>interceptors</title>
      <link>https://traviscj.com/blog/post/2020-05-18-interceptors/</link>
      <pubDate>Mon, 18 May 2020 15:13:00 -0700</pubDate>
      <guid>https://traviscj.com/blog/post/2020-05-18-interceptors/</guid>
      <description>&lt;p&gt;INTERCEPTORS ARE SO COOL!&lt;/p&gt;&#xA;&lt;p&gt;Sometimes you need some &amp;ldquo;generic rails&amp;rdquo; that are still highly adaptable to other uses.&#xA;This is the basic problem solved by the &lt;a href=&#34;https://en.wikipedia.org/wiki/Interceptor_pattern&#34;&gt;Interceptor pattern&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I really love the way &lt;a href=&#34;https://square.github.io/okhttp/&#34;&gt;OkHttp&lt;/a&gt; does &lt;a href=&#34;https://square.github.io/okhttp/interceptors/&#34;&gt;interceptors&lt;/a&gt; for the generic rails of making HTTP calls, so I wanted to walk through a case study of why an interceptor might be useful and then try to synthesize some lessons &amp;amp; a minimal example of the pattern.&lt;/p&gt;</description>
    </item>
    <item>
      <title>smart arguments</title>
      <link>https://traviscj.com/blog/post/2019-02-21-smart-arguments/</link>
      <pubDate>Thu, 21 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2019-02-21-smart-arguments/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s easy to love the terseness one can get out of a command-line tool with a &amp;ldquo;pass by order&amp;rdquo; convention.&#xA;For example, maybe I run something like&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deploy myapp sea2 production&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;to deploy an application called &lt;code&gt;myapp&lt;/code&gt; to the second &lt;strong&gt;production&lt;/strong&gt; datacenter near Seattle.&#xA;This works great, except now I need to remember the order of arguments is: &lt;code&gt;deploy [app] [datacenter] [environment]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The typical solve for this problem is introducing named arguments, so you&amp;rsquo;d end up with&lt;/p&gt;</description>
    </item>
    <item>
      <title>pattern: extract mutating variables to State class</title>
      <link>https://traviscj.com/blog/post/2019-01-07-pattern_extract_mutating_variables_to_state_class/</link>
      <pubDate>Mon, 07 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2019-01-07-pattern_extract_mutating_variables_to_state_class/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve come to really like the pattern of extracting local or instance variables into their own &lt;code&gt;State&lt;/code&gt; class, and writing an algorithm in terms of that &lt;code&gt;State&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A really trivial (if contrived) example of this would be a &amp;ldquo;sum cubes&amp;rdquo; algorithm; something like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;CubeSummer&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;final&lt;/span&gt; PrintStream printStream;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;long&lt;/span&gt; i;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;long&lt;/span&gt; sum;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;CubeSummer&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;printStream&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    reset();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;long&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;sumCubes&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;long&lt;/span&gt; limit) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (; i&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;limit; i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      sum &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; i;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      display();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; sum;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;reset&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sum &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;display&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printStream.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;i = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;;&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printStream.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; sum = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; sum);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What&amp;rsquo;s happened here is we&amp;rsquo;ve essentially promoted some variables that should arguably be &lt;em&gt;local&lt;/em&gt; variables into &lt;em&gt;instance&lt;/em&gt; variables, to avoid needing to pass them around explicitly.&#xA;But in the process, we&amp;rsquo;ve also mixed long-lived state with short-lived state, broken thread safety, and forced clients of this class into a particular calling convention (either instantiate an instance per &lt;code&gt;sumCubes&lt;/code&gt; call or carefully respect thread safety and call &lt;code&gt;#reset()&lt;/code&gt;.)&lt;/p&gt;</description>
    </item>
    <item>
      <title>robustness principle and mocks</title>
      <link>https://traviscj.com/blog/post/2018-07-11-robustness-principle-and-mocks/</link>
      <pubDate>Wed, 11 Jul 2018 11:53:54 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-07-11-robustness-principle-and-mocks/</guid>
      <description>&lt;p&gt;The &lt;a href=&#34;https://en.wikipedia.org/wiki/Robustness_principle&#34;&gt;Robustness Principle&lt;/a&gt; (or Postel&amp;rsquo;s Law) states&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Be conservative in what you do, be liberal in what you accept from others (often reworded as &amp;ldquo;Be conservative in what you send, be liberal in what you accept&amp;rdquo;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This principle &lt;a href=&#34;https://softwareengineering.stackexchange.com/questions/12401/be-liberal-in-what-you-accept-or-not&#34;&gt;has&lt;/a&gt; &lt;a href=&#34;http://trevorjim.com/postels-law-is-not-for-you/&#34;&gt;some&lt;/a&gt; &lt;a href=&#34;https://programmingisterrible.com/post/42215715657/postels-principle-is-a-bad-idea&#34;&gt;criticisms&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I realized this has interesting implications for &lt;a href=&#34;https://en.wikipedia.org/wiki/Mock_object&#34;&gt;mocks&lt;/a&gt;.&#xA;Suppose you have&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public class MyObj {&#xA;  private final Integer x;&#xA;  &#xA;  public MyObj(Integer x) {&#xA;    if (x &amp;lt; 0) {&#xA;      throw new IllegalArgumentException(&amp;quot;negative x!&amp;quot;);&#xA;    }&#xA;    this.x = x;&#xA;  }&#xA;  &#xA;  public int getX() {&#xA;    return x;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In a unit test, we can have&lt;/p&gt;</description>
    </item>
    <item>
      <title>constraint violations in tests</title>
      <link>https://traviscj.com/blog/post/2018-05-31-constraint_violations_in_tests/</link>
      <pubDate>Thu, 31 May 2018 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-05-31-constraint_violations_in_tests/</guid>
      <description>&lt;p&gt;I had some test code that looked something like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@Test public void a() {&#xA;  db.insert(0, &amp;quot;a&amp;quot;);&#xA;  assertThat(db.query(1).getKey()).isEqualTo(&amp;quot;a&amp;quot;);&#xA;}&#xA;&#xA;@Test public void b() {&#xA;  db.insert(0, &amp;quot;a&amp;quot;);&#xA;  db.insert(1, &amp;quot;b&amp;quot;);&#xA;  assertThat(db.query(2).getKey()).isEqualTo(&amp;quot;b&amp;quot;);&#xA;}&#xA;&#xA;@Test public void c() {&#xA;  assertThat(db.query(3)).isNull();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There&amp;rsquo;s some stuff to like about this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;pretty straightforward which test is touching which records&lt;/li&gt;&#xA;&lt;li&gt;pretty clear what you expect to see in the database.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;There&amp;rsquo;s a bunch of coincidences here that make this work, though:&lt;/p&gt;</description>
    </item>
    <item>
      <title>regex in java</title>
      <link>https://traviscj.com/blog/post/2018-02-23-regex-in-java/</link>
      <pubDate>Fri, 23 Feb 2018 13:41:22 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-02-23-regex-in-java/</guid>
      <description>&lt;p&gt;I can never remember how to do java regexes with Pattern.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Pattern pattern &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Pattern.&lt;span style=&#34;color:#a6e22e&#34;&gt;compile&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;x_(yy|zz)&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;String input &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;x_yy&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;boolean&lt;/span&gt; m &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pattern.&lt;span style=&#34;color:#a6e22e&#34;&gt;asPredicate&lt;/span&gt;().&lt;span style=&#34;color:#a6e22e&#34;&gt;test&lt;/span&gt;(input);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;matches: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; m);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Matcher matcher &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pattern.&lt;span style=&#34;color:#a6e22e&#34;&gt;matcher&lt;/span&gt;(input);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (matcher.&lt;span style=&#34;color:#a6e22e&#34;&gt;find&lt;/span&gt;()) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;whole matched string: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; matcher.&lt;span style=&#34;color:#a6e22e&#34;&gt;group&lt;/span&gt;(0));&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;matched group: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; matcher.&lt;span style=&#34;color:#a6e22e&#34;&gt;group&lt;/span&gt;(1));&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I also learned a really cool thing IntelliJ can do with pattern matches!&lt;/p&gt;&#xA;&lt;p&gt;![java regex]({{ site.baseurl }}/assets/java-regex.png)&lt;/p&gt;</description>
    </item>
    <item>
      <title>guava RangeMap</title>
      <link>https://traviscj.com/blog/post/2018-01-26-guava-rangemap/</link>
      <pubDate>Fri, 26 Jan 2018 09:52:41 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-01-26-guava-rangemap/</guid>
      <description>&lt;p&gt;We had some code like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;NavigableMap&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;Double, Integer&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; PRIORITY_MULTIPLIERS &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; TreeMap&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;Double, Integer&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt;() {{ &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;{{ &amp;#34;&lt;/span&gt; }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  put(LOW_THRESHOLD, 1);    &lt;span style=&#34;color:#75715e&#34;&gt;// (20k..40k)  =&amp;gt; 1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  put(MEDIUM_THRESHOLD, 2); &lt;span style=&#34;color:#75715e&#34;&gt;// [40k..100k) =&amp;gt; 2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  put(HIGH_THRESHOLD, 3);   &lt;span style=&#34;color:#75715e&#34;&gt;// [100k..+∞)  =&amp;gt; 3&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}};&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Integer &lt;span style=&#34;color:#a6e22e&#34;&gt;getPriorityMultiplier&lt;/span&gt;(Double v) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (v &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; LOW_THRESHOLD) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; 0;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; PRIORITY_MULTIPLIERS.&lt;span style=&#34;color:#a6e22e&#34;&gt;floorEntry&lt;/span&gt;(v).&lt;span style=&#34;color:#a6e22e&#34;&gt;getValue&lt;/span&gt;()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I replaced with a [&lt;code&gt;RangeMap&lt;/code&gt;][RangeMap] that uses [&lt;code&gt;Range&lt;/code&gt;][Range] instances as keys:&#xA;[RangeMap]: &lt;a href=&#34;https://google.github.io/guava/releases/16.0/api/docs/com/google/common/collect/RangeMap.html&#34;&gt;https://google.github.io/guava/releases/16.0/api/docs/com/google/common/collect/RangeMap.html&lt;/a&gt;&#xA;[Range]: &lt;a href=&#34;https://google.github.io/guava/releases/16.0/api/docs/com/google/common/collect/Range.html&#34;&gt;https://google.github.io/guava/releases/16.0/api/docs/com/google/common/collect/Range.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RangeMap&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;Double, Integer&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; PRIORITY_MULTIPLIERS &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; ImmutableRangeMap.&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;Double, Long&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt;builder()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      .&lt;span style=&#34;color:#a6e22e&#34;&gt;put&lt;/span&gt;(Range.&lt;span style=&#34;color:#a6e22e&#34;&gt;lessThan&lt;/span&gt;(LOW_THRESHOLD), 0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      .&lt;span style=&#34;color:#a6e22e&#34;&gt;put&lt;/span&gt;(Range.&lt;span style=&#34;color:#a6e22e&#34;&gt;closedOpen&lt;/span&gt;(LOW_THRESHOLD, MEDIUM_THRESHOLD), 1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      .&lt;span style=&#34;color:#a6e22e&#34;&gt;put&lt;/span&gt;(Range.&lt;span style=&#34;color:#a6e22e&#34;&gt;closedOpen&lt;/span&gt;(MEDIUM_THRESHOLD, HIGH_THRESHOLD), 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      .&lt;span style=&#34;color:#a6e22e&#34;&gt;put&lt;/span&gt;(Range.&lt;span style=&#34;color:#a6e22e&#34;&gt;atLeast&lt;/span&gt;(HIGH_THRESHOLD), 3)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      .&lt;span style=&#34;color:#a6e22e&#34;&gt;build&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Integer &lt;span style=&#34;color:#a6e22e&#34;&gt;getPriorityMultiplier&lt;/span&gt;(Double v) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; rangePriorityMultipliers.&lt;span style=&#34;color:#a6e22e&#34;&gt;get&lt;/span&gt;(v);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Advantages here being:&lt;/p&gt;</description>
    </item>
    <item>
      <title>todobackend.com</title>
      <link>https://traviscj.com/blog/post/2018-01-05-todobackend.com/</link>
      <pubDate>Fri, 05 Jan 2018 00:01:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-01-05-todobackend.com/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.todobackend.com/&#34;&gt;TodoBackend.com&lt;/a&gt; defines &lt;a href=&#34;http://www.todobackend.com/contribute.html&#34;&gt;a simple API&lt;/a&gt; and has a frontend that works given any backend URL.&lt;/p&gt;&#xA;&lt;p&gt;Particularly interesting to me:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/jhedev/todobackend-haskell&#34;&gt;haskell&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;super concise!&lt;/li&gt;&#xA;&lt;li&gt;whoa, 6 different backends!&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/jhedev/todobackend-haskell/blob/master/todobackend-spock/src/Main.hs&#34;&gt;spock backend&lt;/a&gt; is crazy concise.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/Faerbit/todo-backend-flask/blob/master/todo/views.py&#34;&gt;python + flask&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;seems like it would greatly benefit from a &lt;code&gt;Store&lt;/code&gt; object&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/raboof/todo-backend-akka/blob/master/src/main/scala/net/bzzt/todo/backend/akka/TodoStorage.scala&#34;&gt;scala + akka&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;crazy pattern matching in &lt;a href=&#34;https://github.com/raboof/todo-backend-akka/blob/master/src/main/scala/net/bzzt/todo/backend/akka/TodoRoutes.scala&#34;&gt;routes definition&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/ismagilov/todobackend-mangooio/tree/master/src/main/java&#34;&gt;java + mangooio + jOOQ&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;especially the distinction between &lt;code&gt;Todo&lt;/code&gt; and &lt;code&gt;TodoPatch&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;also really glad I don&amp;rsquo;t have to write &lt;a href=&#34;https://github.com/ismagilov/todobackend-mangooio/blob/master/src/main/resources/routes.yaml&#34;&gt;routes config&lt;/a&gt; separately from the code!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/akiellor/todo-backend-compojure/blob/master/src/todo_backend_compojure/&#34;&gt;clojure + jetty/compojure + postgresql&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/hammerdr/todo-backend-rails&#34;&gt;rails&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/meier-christoph/todo-backend-golang-goa/blob/master/app/controllers.go&#34;&gt;go + goa&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
    <item>
      <title>url encoding safe relational operators</title>
      <link>https://traviscj.com/blog/post/2017-11-29-url-encoding-safe-relational-operators/</link>
      <pubDate>Wed, 29 Nov 2017 07:55:04 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2017-11-29-url-encoding-safe-relational-operators/</guid>
      <description>&lt;p&gt;I was catching up on &lt;a href=&#34;https://publicobject.com/&#34;&gt;Jesse Wilson&amp;rsquo;s blog&lt;/a&gt; this morning, and in particular his post &lt;a href=&#34;https://publicobject.com/2017/08/01/url-encoding-is-material/&#34;&gt;URL Encoding Is Material&lt;/a&gt;.&#xA;In that article, he says&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;My advice&lt;/p&gt;&#xA;&lt;p&gt;If you’re defining your own URLs, you’ll save a lot of trouble by avoiding characters like &amp;lt;, &amp;gt;, {, }, +, ^, &amp;amp;, |, and ;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I came across this problem in one of my projects at work:&#xA;I wanted a page to display some recent records with 1) a &lt;code&gt;name&lt;/code&gt; field provided by the user and 2) a &lt;code&gt;value&lt;/code&gt; field that match $l \leq \text{value} \leq b$, where $l$ and $b$ are given by the user.&#xA;I also wanted that page to have a URL representing that condition, so that it could be easily shared with teammates and soforth.&#xA;When I started working on it, I didn&amp;rsquo;t have Jesse&amp;rsquo;s wisdom, and so I naively came up with a URL structure something like&lt;/p&gt;</description>
    </item>
    <item>
      <title>python attrs</title>
      <link>https://traviscj.com/blog/post/2017-08-31-python-attrs/</link>
      <pubDate>Thu, 31 Aug 2017 08:42:43 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2017-08-31-python-attrs/</guid>
      <description>&lt;p&gt;I came across a very interesting library in a &lt;a href=&#34;https://news.ycombinator.com/item?id=15131981&#34;&gt;HN thread&lt;/a&gt;: the python &lt;a href=&#34;http://www.attrs.org/en/stable/examples.html&#34;&gt;attrs&lt;/a&gt; library.&lt;/p&gt;&#xA;&lt;p&gt;In particular, this seems like a great way to do the &amp;ldquo;dumb data objects&amp;rdquo; they talk about in &lt;a href=&#34;https://www.youtube.com/watch?v=3MNVP9-hglc&#34;&gt;the end of object inheritance&lt;/a&gt;, and also related to (but maybe lighter weight than) &lt;a href=&#34;https://zopeinterface.readthedocs.io/en/latest/README.html&#34;&gt;zope.interface&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This also seems very similar to what I use &lt;a href=&#34;https://github.com/google/auto&#34;&gt;autovalue&lt;/a&gt; for at work.&lt;/p&gt;&#xA;&lt;p&gt;One particularly interesting application is a &amp;ldquo;code database&amp;rdquo; &amp;ndash; using static, checked-in-to-version-control definitions of some data model as a sort of very-fast-to-read, very-slow-to-update &amp;ldquo;Data Model&amp;rdquo;.&#xA;I find this fascinating:&#xA;Code shares a lot of properties with great data stores: ability to rollback (&lt;code&gt;git revert&lt;/code&gt;) and accountability/auditability (&lt;code&gt;git blame&lt;/code&gt;).&#xA;It also makes a lot of fairly hard problems much simpler: you don&amp;rsquo;t need to poll the database for changes.&#xA;You don&amp;rsquo;t need to invalidate any caches.&#xA;You don&amp;rsquo;t need to consider a &amp;ldquo;split brain&amp;rdquo; environment where half of the in-memory caches have updated but the other half haven&amp;rsquo;t.&#xA;You don&amp;rsquo;t need to consider failure cases of how long the in-memory cache is allowed to be invalid: you just fail to boot up on deploy.&#xA;(Admittedly, there&amp;rsquo;s still an opportunity window for split brain behavior for the duration of the deploy, but this is a lot easier to reason about than an essentially arbitrary.)&lt;/p&gt;</description>
    </item>
    <item>
      <title>use the `locale.currency` library function</title>
      <link>https://traviscj.com/blog/post/2017-01-20-use_the_locale.currency_library_function/</link>
      <pubDate>Fri, 20 Jan 2017 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2017-01-20-use_the_locale.currency_library_function/</guid>
      <description>&lt;p&gt;I had stupidly written a pair of functions like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def comma_sep(amount):&#xA;    thousands = int(amount/1000)&#xA;    remainder = int(amount%1000)&#xA;    if thousands &amp;gt; 0:&#xA;        return comma_sep(thousands)+&amp;quot;,&amp;quot;+&amp;quot;%.3d&amp;quot;%(remainder)&#xA;    else:&#xA;        return str(remainder)&#xA;def friendly_from_cents(total_cents):&#xA;    pos = total_cents &amp;gt;= 0&#xA;    total_cents = abs(total_cents)&#xA;    cents = int(total_cents%100)&#xA;    dollars = int(total_cents/100)&#xA;    friendly = &amp;quot;$&amp;quot;+comma_sep(dollars)+&amp;quot;.&amp;quot;+str(cents)&#xA;    if pos:&#xA;        return friendly&#xA;    else:&#xA;        return &amp;quot;-&amp;quot; + friendly&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is stupid, because python has builtin support to localize currency:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import locale&#xA;locale.setlocale(locale.LC_ALL, &#39;en_US&#39;)&#xA;locale.currency(-1800, grouping=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I think it&amp;rsquo;s tempting to fall into these traps, because it always starts simpler:&#xA;I had some &lt;code&gt;total_cents&lt;/code&gt; variable and just wanted to display quick and dirty.&#xA;The complexity built up gradually, until I had something pretty complicated.&#xA;Oops.&lt;/p&gt;</description>
    </item>
    <item>
      <title>filter vs spec (draft)</title>
      <link>https://traviscj.com/blog/post/2017-01-18-filter_vs_spec/</link>
      <pubDate>Wed, 18 Jan 2017 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2017-01-18-filter_vs_spec/</guid>
      <description>&lt;p&gt;Consider a silly data model to store data about cities like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;message City {&#xA;  optional string city_name = 1;&#xA;  optional string state = 2;&#xA;  optional int32 population = 3;&#xA;  optional int32 year_founded = 4;&#xA;  // ... presumably others :-)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and some sample data like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&amp;quot;city_name&amp;quot;: &amp;quot;Portland&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;OR&amp;quot;, &amp;quot;population&amp;quot;: ...},&#xA;  {&amp;quot;city_name&amp;quot;: &amp;quot;Portland&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;ME&amp;quot;, &amp;quot;population&amp;quot;: ...},&#xA;  {&amp;quot;city_name&amp;quot;: &amp;quot;Springfield&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;FL&amp;quot;, &amp;quot;population&amp;quot;: ...},&#xA;  {&amp;quot;city_name&amp;quot;: &amp;quot;Springfield&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;IL&amp;quot;, &amp;quot;population&amp;quot;: ...},&#xA;  {&amp;quot;city_name&amp;quot;: &amp;quot;Springfield&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;CO&amp;quot;, &amp;quot;population&amp;quot;: ...}&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There are some useful entities we can define: (DRAFT NB: don&amp;rsquo;t read too much into the matcher vs filter lingo.)&lt;/p&gt;</description>
    </item>
    <item>
      <title>CBCL: The Common Business Communication Language</title>
      <link>https://traviscj.com/blog/post/2016-12-12-cbcl/</link>
      <pubDate>Mon, 12 Dec 2016 23:05:28 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2016-12-12-cbcl/</guid>
      <description>&lt;p&gt;I recently came across McCarthy&amp;rsquo;s &lt;a href=&#34;http://www-formal.stanford.edu/jmc/cbcl2.pdf&#34;&gt;CBCL&lt;/a&gt; paper on Hacker News.&#xA;He presents a Lisp notation as a format for sharing requests between different software on different computers.&#xA;He calls out&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;(PLEASE-RESERVE (EPSILON (x) &#xA;  (AND&#xA;    (IS-FLIGHT x) &#xA;    (DEPARTS MONDAY) &#xA;    (ARRIVES (BEFORE WEDNESDAY)))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where $\epsilon x$ is an operator maps a predicate to &lt;em&gt;a value&lt;/em&gt; matching the predicate, and considers it an improvement on the &amp;ldquo;iota&amp;rdquo; &lt;a href=&#34;https://en.wikipedia.org/wiki/Definite_description#Mathematical_logic&#34;&gt;definite description&lt;/a&gt; operator, which seems to be an operator that returns &lt;em&gt;the unique value&lt;/em&gt; matching the predicate.&#xA;It seems interesting to me that the unique match operator is not considered as useful as the arbitrary match operator &amp;ndash; unique keys actually seem critical to a lot of my work with data models.&#xA;Even more fascinating, though, is that this &lt;em&gt;looks&lt;/em&gt; like an anonymous function!&lt;/p&gt;</description>
    </item>
    <item>
      <title>oblique programming strategies</title>
      <link>https://traviscj.com/blog/post/2016-12-07-oblique_programming_strategies/</link>
      <pubDate>Wed, 07 Dec 2016 23:05:28 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2016-12-07-oblique_programming_strategies/</guid>
      <description>&lt;p&gt;Ever since I found out about it (probably on Hacker News), the idea of &lt;a href=&#34;https://en.wikipedia.org/wiki/Oblique_Strategies&#34;&gt;Oblique Strategies&lt;/a&gt; has fascinated me.&#xA;The first editions are going on ebay for $2500-$3300 bucks, which I think is incredible.&#xA;If you&amp;rsquo;re curious &lt;em&gt;and&lt;/em&gt; impatient, you can check out &lt;a href=&#34;https://github.com/ceejbot/oblique-strategies/blob/master/index.js&#34;&gt;this list&lt;/a&gt; on github.&lt;/p&gt;&#xA;&lt;p&gt;One recent sleepness night, I made a list of &amp;ldquo;oblique programming strategies&amp;rdquo; on my phone, transcribed here.&#xA;They are not as starkly polished as Eno&amp;rsquo;s version (unsurprisingly), but might be useful to you!&lt;/p&gt;</description>
    </item>
    <item>
      <title>logging</title>
      <link>https://traviscj.com/blog/post/2014-09-26-logging/</link>
      <pubDate>Fri, 26 Sep 2014 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2014-09-26-logging/</guid>
      <description>&lt;p&gt;In grad school, I spent a lot of time writing code that read output from nonlinear optimization solvers, and tried&#xA;to do useful things with it.&#xA;A much better way to do that is called &amp;ldquo;structured logging&amp;rdquo;, an idea I experimented with a bit during grad school.&#xA;It has also been coming up in my working life, so I wanted to delve into it a bit deeper.&#xA;For a quick introduction, check out &lt;a href=&#34;http://gregoryszorc.com/blog/category/logging/&#34;&gt;Thoughts on Logging&lt;/a&gt;.&#xA;For a lot longer introduction, see &lt;a href=&#34;http://engineering.linkedin.com/distributed-systems/log-what-every-software-engineer-should-know-about-real-time-datas-unifying&#34;&gt;The Log: What every software engineer should know about real-time data unifying&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>language fluidity</title>
      <link>https://traviscj.com/blog/post/2013-12-29-language_fluidity/</link>
      <pubDate>Sun, 29 Dec 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-12-29-language_fluidity/</guid>
      <description>&lt;p&gt;I have learned a lot of programming languages over the course of my life. So I wanted to do two things:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Discuss a few effective ways to pick up a new language.&lt;/li&gt;&#xA;&lt;li&gt;Discuss a few references that I&amp;rsquo;ve found helpful for some languages.&#xA;I should start with a disclaimer: I do enjoy learning new languages, but mostly I enjoy creating things in those languages. I&amp;rsquo;m not sure all the effort I have spent learning many languages would not have been better spent learning many fewer languages to a deeper level, but I do feel like it is extremely important to learn principles, not languages, and to use the best tool for a particular job. Many times principles are most clearly illustrated with contrast between languages, and many more times a particular tool has been a patently poor choice for a particular job.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;That being said, it&amp;rsquo;s important to know your “first tongue” languages in significant depth.&lt;/p&gt;</description>
    </item>
    <item>
      <title>square</title>
      <link>https://traviscj.com/blog/post/2013-11-16-square/</link>
      <pubDate>Sat, 16 Nov 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-11-16-square/</guid>
      <description>&lt;p&gt;I probably should have been working on my thesis, but I had a phone interview with Square. I wanted to write a bit of code to get myself “warmed up” but wanted it to be kinda fun. So I decided to write some code that drew a square.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;&#xA;using namespace std;&#xA;&#xA;int main() {&#xA;&#xA;    cout &amp;lt;&amp;lt; &amp;quot;+&amp;quot;;&#xA;    for (int i=0; i&amp;lt;8; i++) cout &amp;lt;&amp;lt; &amp;quot;-&amp;quot;;&#xA;    cout &amp;lt;&amp;lt; &amp;quot;+&amp;quot; &amp;lt;&amp;lt; endl;&#xA;&#xA;    for (int j=0; j&amp;lt;5; j++) {&#xA;        cout &amp;lt;&amp;lt; &amp;quot;|&amp;quot;;&#xA;        for (int i=0; i&amp;lt;8; i++)&#xA;            cout &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&#xA;        cout &amp;lt;&amp;lt; &amp;quot;|&amp;quot;;&#xA;        cout &amp;lt;&amp;lt; endl;&#xA;    }&#xA;&#xA;    cout &amp;lt;&amp;lt; &amp;quot;+&amp;quot;;&#xA;    for (int i=0; i&amp;lt;8; i++) cout &amp;lt;&amp;lt; &amp;quot;-&amp;quot;;&#xA;    cout &amp;lt;&amp;lt; &amp;quot;+&amp;quot; &amp;lt;&amp;lt; endl;&#xA;&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which yields a nice little square:&lt;/p&gt;</description>
    </item>
    <item>
      <title>overly-ambitious-isqo and the design of numerical codes</title>
      <link>https://traviscj.com/blog/post/2013-10-23-overly-ambitious-isqo_and_the_design_of_numerical_codes/</link>
      <pubDate>Wed, 23 Oct 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-10-23-overly-ambitious-isqo_and_the_design_of_numerical_codes/</guid>
      <description>&lt;p&gt;I have finally released the &lt;a href=&#34;https://github.com/traviscj/overly-ambitious-isqo&#34;&gt;overly-ambitious-isqo&lt;/a&gt; project on github!&lt;/p&gt;&#xA;&lt;p&gt;I wanted to call out two particular design concerns I had.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rich-language&#34;&gt;rich language&lt;/h2&gt;&#xA;&lt;p&gt;My first goal was to try very hard to build up the C language to very succinctly express the main algorithm in &lt;code&gt;src/isqo_functor.cpp&lt;/code&gt; in extremely rich language. It seems like numerical code is typically implemented with loops like &lt;code&gt;for (int i=0; i&amp;lt;N; i)&lt;/code&gt; and method calls like &lt;code&gt;deltal(xhat, mu)&lt;/code&gt;. I have found it much easier to reason and think deeply about codes like &lt;code&gt;for (int primal_index=0; primal_index &amp;lt; num_primal; primal_index)&lt;/code&gt; and method calls like &lt;code&gt;linear_model_reduction(penalty_iterate, penalty_parameter)&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C/C&#43;&#43; Values, Pointers, and References</title>
      <link>https://traviscj.com/blog/post/2013-09-20-c_cpp_values_pointers_and_references/</link>
      <pubDate>Fri, 20 Sep 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-09-20-c_cpp_values_pointers_and_references/</guid>
      <description>&lt;p&gt;I had an embarrassing realization: While C does have an address-of operator, it does not include reference variable or pass-by-reference syntax. It&amp;rsquo;s embarrassing because I should have realized that it was a C++ invention; I guess some of my “C” code actually really has been C++ code.&lt;/p&gt;&#xA;&lt;p&gt;For future reference, here&amp;rsquo;s the current summary of my understanding:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;&lt;/th&gt;&#xA;          &lt;th&gt;var&lt;/th&gt;&#xA;          &lt;th&gt;*var&lt;/th&gt;&#xA;          &lt;th&gt;&amp;amp;var&lt;/th&gt;&#xA;          &lt;th&gt;&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;int xv=3;&lt;/td&gt;&#xA;          &lt;td&gt;value&lt;/td&gt;&#xA;          &lt;td&gt;invalid&lt;/td&gt;&#xA;          &lt;td&gt;memory location of value&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;int *xp=&amp;amp;xv;&lt;/td&gt;&#xA;          &lt;td&gt;memory location&lt;/td&gt;&#xA;          &lt;td&gt;value&lt;/td&gt;&#xA;          &lt;td&gt;memory location of pointer.&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;int &amp;amp;xr=xr;&lt;/td&gt;&#xA;          &lt;td&gt;value&lt;/td&gt;&#xA;          &lt;td&gt;invalid&lt;/td&gt;&#xA;          &lt;td&gt;memory location of value&lt;/td&gt;&#xA;          &lt;td&gt;(all invalid in C)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;As one other note, there are three ways you can pass things in C:&lt;/p&gt;</description>
    </item>
    <item>
      <title>python decorators</title>
      <link>https://traviscj.com/blog/post/2013-07-30-python_decorators/</link>
      <pubDate>Tue, 30 Jul 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-07-30-python_decorators/</guid>
      <description>&lt;p&gt;I came across something that I think is actually pretty neat. Python supports ``decorating&amp;rsquo;&amp;rsquo; functions, which lets you define behaviors that essentially wrap around a given function. The benefit is that you can write a simple function and decorate it to do something fancier.&lt;/p&gt;&#xA;&lt;p&gt;I realized I wanted to do this with a simple timing output. Say my function was just something really simple like&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;def f_plain(x,y):&#xA;    print(&amp;#34;x + y = {}&amp;#34;.format( x+y))&#xA;    return x+y&#xA;print (&amp;#34;---&amp;#34;)&#xA;print (f_plain(1,3))&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now, to time it, I could define a function like:&lt;/p&gt;</description>
    </item>
    <item>
      <title>implementation of set operations</title>
      <link>https://traviscj.com/blog/post/2013-03-13-implementation_of_set_operations/</link>
      <pubDate>Wed, 13 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-03-13-implementation_of_set_operations/</guid>
      <description>&lt;p&gt;We got in a bit of a debate yesterday in the office over the implementation of associative containers, which I thought was pretty fun.&#xA;We made up the big chart of complexity results you see below.&lt;/p&gt;&#xA;&lt;h2 id=&#34;nomenclature&#34;&gt;nomenclature:&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$S$, $S_1$, and $S_2$ are subsets of $\Omega$.&lt;/li&gt;&#xA;&lt;li&gt;Denote an element by $e\in\Omega$.&lt;/li&gt;&#xA;&lt;li&gt;$n$,$n_1$,$n_2$,$N$ are the sizes of the set $S$, $S_1$, $S_2$, and $\Omega$, respectively, and $n_1 \geq n_2$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;complexity&#34;&gt;Complexity&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Operation\Approach&lt;/th&gt;&#xA;          &lt;th&gt;Hash Table&lt;/th&gt;&#xA;          &lt;th&gt;Hash Tree&lt;/th&gt;&#xA;          &lt;th&gt;Binary List&lt;/th&gt;&#xA;          &lt;th&gt;Entry List (sorted)&lt;/th&gt;&#xA;          &lt;th&gt;Entry List (unsorted)&lt;/th&gt;&#xA;          &lt;th&gt;&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;$e \in S&#x9;&#x9;  $&lt;/td&gt;&#xA;          &lt;td&gt;$O(1)   &#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(log(n))&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(1)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(log(n))&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;$S_1 \cup S_2    $&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1+n_2)&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1+n_2)&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(N)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1+n_2)&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1n_2)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;$S_1 \cap S_2    $&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(log(n_1)n_2)$&lt;/td&gt;&#xA;          &lt;td&gt;$O(N)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_2)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1n_2)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;space complexity&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)          $&lt;/td&gt;&#xA;          &lt;td&gt;$O(N)$ bits.&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)          $&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)          $&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;As I said&amp;ndash;this was just what came out of my memory of an informal discussion, so I make no guarantees that any of it is correct.&#xA;Let me know if you spot something wrong!&#xA;We used the examples  $S_1 = {1,2,3,4,5}$ and $S_2 = {500000}$ to think through some things.&lt;/p&gt;</description>
    </item>
    <item>
      <title>some tips for project euler problems</title>
      <link>https://traviscj.com/blog/post/2013-01-26-some_tips_for_project_euler_problems/</link>
      <pubDate>Sat, 26 Jan 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-01-26-some_tips_for_project_euler_problems/</guid>
      <description>&lt;p&gt;I wanted to make a list of a few tips on solving &lt;a href=&#34;http://projecteuler.net&#34;&gt;Project Euler&lt;/a&gt; problems that have been helpful for me while I solve them.&#xA;These are general principles, even though I do most of my Project Euler coding in Python.&lt;/p&gt;&#xA;&lt;p&gt;Without further ado:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the problem is asking for something concerning the number of digits, typically this indicates that the use of the $\log n$ function is warranted.&lt;/li&gt;&#xA;&lt;li&gt;If the problem is asking for the last few digits, modulo arithmetic might speed it up considerably.&lt;/li&gt;&#xA;&lt;li&gt;Some might consider this cheating, but looking up some small numbers in the &lt;a href=&#34;http://oeis.org/&#34;&gt;Online Encyclopedia of Integer Sequences&lt;/a&gt; is occasionally pretty helpful.&lt;/li&gt;&#xA;&lt;li&gt;Many problems boil down to: Find numbers with property $X$ and property $Y$. Two solutions are:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Brute force: Try all numbers with tests of property $X$ and $Y$.&lt;/li&gt;&#xA;&lt;li&gt;Find numbers with property $X$ and filter by a test of property $Y$.&lt;/li&gt;&#xA;&lt;li&gt;Find numbers with property $Y$ and filter by a test of property $X$.&lt;/li&gt;&#xA;&lt;li&gt;Find the set of numbers with property $X$ and the set of numbers with property $Y$. Compute their intersection.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve found that it&amp;rsquo;s sometimes hard to predict which one will end up being the fastest.&#xA;It depends on the relative speed of the tests and the generators, and the frequency of finding numbers which have that property.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Integrating Sparrow and Aperture/iPhoto</title>
      <link>https://traviscj.com/blog/post/2012-04-13-integrating_sparrow_and_apertureiphoto/</link>
      <pubDate>Fri, 13 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2012-04-13-integrating_sparrow_and_apertureiphoto/</guid>
      <description>&lt;p&gt;In my recent quest to take on digital photography, I&amp;rsquo;ve been using Apple&amp;rsquo;s Aperture to store download my pictures and do basic manipulation on them. It&amp;rsquo;s been working great, except that emailing is a pain because Apple hardcoded the email clients to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apple Mail.app&lt;/li&gt;&#xA;&lt;li&gt;Eudora (really!?)&lt;/li&gt;&#xA;&lt;li&gt;America Online(!?!)&lt;/li&gt;&#xA;&lt;li&gt;Microsoft Entourage&lt;/li&gt;&#xA;&lt;li&gt;Microsoft Outlook&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;while I&amp;rsquo;d prefer to use Sparrow, a lightweight client that Sharvil got me hooked on a while back. Rather than continue to use Mail.app to send pictures via email, I found out that Aperture actually uses some AppleScripts to do the actual sending of the email. That got me thinking: I just need to change the script to mail using Sparrow, instead of Mail.&lt;/p&gt;</description>
    </item>
    <item>
      <title>HMCP Set, TextMate, and RoR 2.0</title>
      <link>https://traviscj.com/blog/post/2009-02-06-hmcp_set_textmate_and_ror_2.0/</link>
      <pubDate>Fri, 06 Feb 2009 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2009-02-06-hmcp_set_textmate_and_ror_2.0/</guid>
      <description>&lt;p&gt;I found a great little LaTeX homework layout for typesetting math homeworks a while back, and I&amp;rsquo;ve meant to write it up for quite a while. It&amp;rsquo;s from Harvey Mudd College&amp;rsquo;s Mathematics Department, engineered to automatically satisfy the department guidelines on how homeworks should be laid out. They also have thesis and poster templates, but the homework installation proceedures and sty files are located on the &lt;a href=&#34;http://www.math.hmc.edu/computing/support/tex/classes/hmcpset/&#34;&gt;Homework Class&lt;/a&gt; page. Their website also has extensive information on their computer resources. While basically useless for anyone not at Harvey Mudd, it is a model for how this sort of website should look. Everything is clearly detailed at the perfect level, along with suggestions not just for how to do certain tasks, but also when you might want to do something.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Fame and FORTRAN</title>
      <link>https://traviscj.com/blog/post/2008-11-08-fame_and_fortran/</link>
      <pubDate>Sat, 08 Nov 2008 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-11-08-fame_and_fortran/</guid>
      <description>&lt;p&gt;I must be getting more popular on some search engines somewhere. I just got six random comment-spam messages. Awesome. I guess that&amp;rsquo;s why the more important bloggers have come to rely on Bayesian filters and soforth for taming the wild flow of spam. Hopefully that trend doesn&amp;rsquo;t continue.&lt;/p&gt;&#xA;&lt;p&gt;Also, it seems as though I am now learning FORTRAN. I&amp;rsquo;m sortof starting working with Eric Shea-Brown on some Neuroscience research, working with HPC on NSF&amp;rsquo;s Teragrid. It&amp;rsquo;s pretty exciting stuff, and I&amp;rsquo;m really excited about getting moving on it. Anyways, back to FORTRANizing, I suppose.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHP Vulnerability Checklist</title>
      <link>https://traviscj.com/blog/post/2008-07-10-php_vulnerability_checklist/</link>
      <pubDate>Thu, 10 Jul 2008 12:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-07-10-php_vulnerability_checklist/</guid>
      <description>&lt;p&gt;Ray(the boss) and I were chatting about how we should implement our secure upload page. The way it should work is, an IP is added to the genhosts database, it sets up a 5 minute wait, and at the end of five minutes, redirects to the data upload page, at which point the computer is allowed to connect, since the new IP has propogated into /etc/hosts.allow(via a cronjob that takes MySQL entries and parses them(via HTTP and XML) into the standard /etc/hosts.allow format). It’s basically working, but we’re having a bunch of trouble getting IE and Firefox to redirect, since IE apparently detects my window.location.href and location.replace calls as popups, and blocks them.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Cython</title>
      <link>https://traviscj.com/blog/post/2008-05-09-cython/</link>
      <pubDate>Fri, 09 May 2008 12:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-05-09-cython/</guid>
      <description>&lt;p&gt;After I had finally convinced myself to get out of bed this morning to go to my ACMS seminar, I quickly checked my email and my heart sank a little. Today’s talk was on SAGE. Don’t have anything against SAGE, but I thought it was just a big pile of open source packages in a big, heavy install. Sorta cool, but worthless, in other words.&lt;/p&gt;&#xA;&lt;p&gt;Turns out, I was pretty wrong about that. It is that, but it’s also  70k new lines of code that does a whole bunch of exciting stuff. Near the end of his talk, William Stein mentioned that they had created a new tool called Cython. (Well, extended Pyrex, but… whatever.)&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python Playing</title>
      <link>https://traviscj.com/blog/post/2007-12-28-python_playing/</link>
      <pubDate>Fri, 28 Dec 2007 12:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2007-12-28-python_playing/</guid>
      <description>&lt;p&gt;I’ve been playing around with Python a bit more over the break, mostly because I want to be lazy in my code-writing for the forseeable future, plus I’d like to give NumPy a shot, but I want to have a solid background before trying that. One thing that just has not gotten old yet is the ability to assign functions absolutely anywhere in python. You can pass them around like variables, put them in dictionaries, return them from functions, whatever. I mean, I lived in parenthesis for a while in my scheme class, so it’s not like I haven’t been exposed to it, but it’s still damn cool. You can do cool stuff like making a tuple of some index, some value, and the function to process the other two. That makes it so much easier to deal with various combinations of neat datastructures. Anyways, the book I’ve been reading is Dive Into Python, off diveintopython.org. I’m currently at about page 114 out of 327, and I’ve fairly faithfully read most of it up until that point. The format seems slightly frustrating to me, but it’s probably just because it’s such a departure from what a lot of books and tutorials use. It seems helpful and worthwhile in any case.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
