<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Python on traviscj/blog</title>
    <link>https://traviscj.com/blog/tags/python/</link>
    <description>Recent content in Python on traviscj/blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 04 Jan 2018 00:10:00 +0000</lastBuildDate>
    <atom:link href="https://traviscj.com/blog/tags/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>dancing bull pricing structure</title>
      <link>https://traviscj.com/blog/post/2018-01-04-dancing-bull-pricing-structure/</link>
      <pubDate>Thu, 04 Jan 2018 00:10:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-01-04-dancing-bull-pricing-structure/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.yelp.com/biz/dancing-bull-san-francisco&#34;&gt;Dancing Bull&lt;/a&gt; is a great Korean BBQ restaurant that opened nearby recently.&#xA;They have this pricing scheme:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;assets/bulgogi.jpg&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the &lt;em&gt;unlimited&lt;/em&gt; bulgogi is \$23/person, but the bulgogi &lt;em&gt;a la carte&lt;/em&gt; is \$25/grill (with each additional orders after that costing \$9).&#xA;This raises an obvious question: which is the better deal?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Spoiler&lt;/strong&gt;: it depends on both how many people you have &lt;em&gt;and&lt;/em&gt; how hungry they are.&lt;/p&gt;&#xA;&lt;p&gt;First, we had to clarify how it actually worked.&#xA;It&amp;rsquo;s not clear from the menu, but the &amp;ldquo;\$25/grill&amp;rdquo; includes the first order of bulgogi.&#xA;Introducing $P$ for the number of people, $G$ for the number of grills, and $O$ for the total number of orders, we would pay $$UL = 23\cdot P$$ for the unlimited price scheme vs $$ALC = 25\cdot G + 9\cdot ( O - G)$$ for the a la carte scheme.&lt;/p&gt;</description>
    </item>
    <item>
      <title>snack buying</title>
      <link>https://traviscj.com/blog/post/2017-11-13-snack-buying/</link>
      <pubDate>Mon, 13 Nov 2017 07:01:25 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2017-11-13-snack-buying/</guid>
      <description>&lt;p&gt;I got this text message from my father-in-law:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Ok. Soda 1.50&#xA;Chocolate bar 1.00&#xA;Gum 0.10&#xA;Jelly Bean .05&lt;/p&gt;&#xA;&lt;p&gt;Have to buy exactly 14 items and spend $10&lt;/p&gt;&#xA;&lt;p&gt;At least one of each.&lt;/p&gt;&#xA;&lt;p&gt;There are 4 diff combos. (Order: soda, chocolate, gum and jelly bean)&lt;/p&gt;&#xA;&lt;p&gt;Got 5-2-3-4&#xA;3-5-4-2&lt;/p&gt;&#xA;&lt;p&gt;Can’t get others. Any ideas?  :)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I whipped up this solution to check in python:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/python3&#xA;# created_at: 2017-11-13 13:53:19 -0800&#xA;&#xA;def main():&#xA;    solutions = 0&#xA;    for si in range(1,7):&#xA;        for ci in range(1,11):&#xA;            for gi in range(1,101):&#xA;                for ji in range(1,201):&#xA;                    total = si*150 + ci*100 + gi*10 + ji*5&#xA;                    items = si + ci + gi + ji&#xA;                    if total == 1000 and items == 14:&#xA;                        print(si,ci,gi,ji, total, items)&#xA;                        solutions += 1&#xA;    print(solutions)&#xA;&#xA;if __name__ == &amp;quot;__main__&amp;quot;:&#xA;    main()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The core of this solution is the check&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>toy/life data models</title>
      <link>https://traviscj.com/blog/post/2017-04-19-toy_life_data_models/</link>
      <pubDate>Wed, 19 Apr 2017 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2017-04-19-toy_life_data_models/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been experimenting a lot with some kinda &amp;ldquo;toy&amp;rdquo; data models based on random things that I wish there was a database to query, but isn&amp;rsquo;t.&#xA;For example:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What was my average arrival time this week?&lt;/li&gt;&#xA;&lt;li&gt;How much of my equity has vested before a certain date?&lt;/li&gt;&#xA;&lt;li&gt;When was the last time we had spaghetti for dinner?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been doing this with flat JSON files.&#xA;This is a bit of an odd choice for me; I actually love schematizing data models in protobuf and MySQL and designing proper indices for the data models I work on during work hours.&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>streaks vs statistical streaks</title>
      <link>https://traviscj.com/blog/post/2016-09-26-streaks_vs_statistical_streaks/</link>
      <pubDate>Mon, 26 Sep 2016 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2016-09-26-streaks_vs_statistical_streaks/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://hn.algolia.com/?query=streaks&amp;amp;sort=byPopularity&amp;amp;prefix&amp;amp;page=0&amp;amp;dateRange=all&amp;amp;type=story&#34;&gt;Hacker News et al are obsessed with streaks&lt;/a&gt;, but I think they have some problems:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A single regression resets to zero.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;There&amp;rsquo;s not an easy way to gradually ramp up your streak-commitment over time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I prefer a different approach: statistical streaks.&lt;/p&gt;&#xA;&lt;p&gt;Suppose I made a commitment to do something differently on 2016-08-26, and did it for the next 5 days; then my 30-day statistical streak avg = 0.166, but my 5-day statistical streak avg = 1.0.&lt;/p&gt;</description>
    </item>
    <item>
      <title>switching over to https</title>
      <link>https://traviscj.com/blog/post/2016-04-15-switching_over_to_https/</link>
      <pubDate>Fri, 15 Apr 2016 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2016-04-15-switching_over_to_https/</guid>
      <description>&lt;p&gt;One of the things I&amp;rsquo;ve been meaning to do forever is switch things over to https.&#xA;By &amp;ldquo;things&amp;rdquo;, I mean the set of websites I run for some family and friends.&#xA;I tried it out with my personal website first, then flipped over the rest.&lt;/p&gt;&#xA;&lt;h2 id=&#34;implementation-notes&#34;&gt;implementation notes&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I used the &lt;a href=&#34;https://letsencrypt.org/getting-started/&#34;&gt;letsencrypt start guide&lt;/a&gt; to generate the certificates.&lt;/li&gt;&#xA;&lt;li&gt;Modified the nginx config to:&#xA;a. serve ssl/https traffic on port 443 for the given domain with the proper https certificates/etc.&#xA;b. forward non-ssl/http traffic on port 80 to port 443 for the given domain&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;verification&#34;&gt;verification&lt;/h2&gt;&#xA;&lt;p&gt;It turns out that the nginx configuration files are a little bit error prone.&#xA;This probably means that I am doing something wrong, like not using some configuration management tool like puppet or ansible or whatever.&#xA;But for something as small scale as my site, it doesn&amp;rsquo;t really meet the cost-benefit threshold for learning a new tool/language.&#xA;I also even considered spinning up a simple one-off configuration generator that I&amp;rsquo;d need to figure out how to override and extend as needed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>inspired by magicmirror</title>
      <link>https://traviscj.com/blog/post/2016-01-02-inspired_by_magicmirror/</link>
      <pubDate>Sat, 02 Jan 2016 18:45:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2016-01-02-inspired_by_magicmirror/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been really inspired by the &lt;a href=&#34;https://github.com/MichMich/MagicMirror&#34;&gt;MagicMirror&lt;/a&gt; project.&#xA;The basic idea is getting a piece of mirror glass and putting a monitor and computer behind it, then having a status page show some pertinent information about the day (like weather, calendar, news, etc).&#xA;So it looks like a regular mirror, but when you look closely, it shows the extra information.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;d like to put one in the bedroom to replace our tall mirror.&#xA;That&amp;rsquo;ll be pretty cool, but it requires a bit of extra thought because&#xA;our magicmirror setup would replace a tall and skinny mirror, so we&amp;rsquo;ll probably just want a monitor behind the &lt;em&gt;top&lt;/em&gt; part of the mirror.&#xA;That will require some extra bracing to hold the monitor up in the frame.&#xA;I&amp;rsquo;ll need to think about that a while.&lt;/p&gt;</description>
    </item>
    <item>
      <title>black box machine learning</title>
      <link>https://traviscj.com/blog/post/2014-07-15-black_box_machine_learning/</link>
      <pubDate>Tue, 15 Jul 2014 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2014-07-15-black_box_machine_learning/</guid>
      <description>&lt;p&gt;During my Ph.D. I studied optimization algorithms.&#xA;Optimization algorithms are typically an integral part of machine learning algorithms, and we discussed many machine&#xA;learning algorithms, but somehow I made it through without doing very much actual machine learning training or&#xA;prediction tasks.&lt;/p&gt;&#xA;&lt;p&gt;It turns out that it isn&amp;rsquo;t very hard to do some very basic machine learning:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install -U numpy scipy scikit-learn&#xA;ipython&#xA;from sklearn.ensemble import RandomForestClassifier&#xA;from sklearn import datasets&#xA;iris_data = datasets.load_iris()&#xA;rfc = RandomForestClassifier()&#xA;rfc.fit(iris_data[&#39;data&#39;], iris_data[&#39;target&#39;])&#xA;rfc.predict([6.1,2.6,5.6,1.4])    # yields array([2])&#xA;rfc.predict([5.7,4.4,1.5,0.4])    # yields array([0])&#xA;&lt;/code&gt;&lt;/pre&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>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>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>Meta post - How my blog works</title>
      <link>https://traviscj.com/blog/post/2012-07-27-meta_post_how_my_blog_works/</link>
      <pubDate>Fri, 27 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2012-07-27-meta_post_how_my_blog_works/</guid>
      <description>&lt;p&gt;A while back, Sharvil requested a quick overview of how I post stuff to my blog, so I thought I&amp;rsquo;d post a rundown of it.&lt;/p&gt;&#xA;&lt;p&gt;At the base, I use a git repository to store files named entryNNNN.txt. Each has the basic format:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;title: Meta post: How my blog works&#xA;date: 2012/07/27&#xA;category: software&#xA;---&#xA;A while back, Sharvil requested a quick overview of how I post stuff to my blog, so I thought I&amp;#39;d post a rundown of it.&#xA;At the base, I use a git repository to store files named entryNNNN.txt. Each has the basic format:&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To start a new post and fill in some of this, I have a script called &amp;rsquo;newentry.sh&amp;rsquo;, which determines the latest entry number and adds one to get a new filename (eg, entry0081.txt).&lt;/p&gt;</description>
    </item>
    <item>
      <title>More cracking D-Link Files</title>
      <link>https://traviscj.com/blog/post/2012-06-27-more_cracking_d-link_files/</link>
      <pubDate>Wed, 27 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2012-06-27-more_cracking_d-link_files/</guid>
      <description>&lt;p&gt;Somehow, in the process of a router reconfiguration, I reset the password without the new password getting saved into 1Password.&#xA;So I found myself locked out of my own router.&#xA;I was about to reset it, thinking, &amp;ldquo;Hey, at least I have a backup of the settings from 2 nights ago!&amp;rdquo; and then realized, &amp;ldquo;I bet that settings file has the password right in it.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Googling around a bit turned up &lt;a href=&#34;http://www.shulerent.com/2009/08/21/cracking-the-d-link-settings-file/&#34;&gt;this guy&lt;/a&gt;, but he only wrote VBA and a Windows binary.&#xA;His pseudo-code looked pretty easy to translate into Python, so I did just that. Here&amp;rsquo;s the result: &lt;a href=&#34;https://github.com/traviscj/decode_gws&#34;&gt;D-Link DIR615 B2 v2.25 Decoder&lt;/a&gt; (no encoder, yet&amp;hellip;)&lt;/p&gt;</description>
    </item>
    <item>
      <title>tjtestharness - a language-agnostic DVCS unit-test/continuous integration tool</title>
      <link>https://traviscj.com/blog/post/2012-03-26-tjtestharness_-_a_language-agnostic_dvcs_unit-testcontinuous_integration_tool/</link>
      <pubDate>Mon, 26 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2012-03-26-tjtestharness_-_a_language-agnostic_dvcs_unit-testcontinuous_integration_tool/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been wanting to have a way to visualize which unit tests(or sets of them) passed for a given commit, if for no other reason than the sense of accomplishment from watching boxes turn yellow, then green, as they pass tests.&#xA;The trouble is, I write code in a lot of different languages for a lot of different projects.&#xA;I also don&amp;rsquo;t want to bother with running unit tests individually&amp;ndash;I want them to run as I perform commits.&lt;/p&gt;</description>
    </item>
    <item>
      <title>tcjblog.py</title>
      <link>https://traviscj.com/blog/post/2011-09-09-tcjblogpy/</link>
      <pubDate>Fri, 09 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2011-09-09-tcjblogpy/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve now (for the most part) finished a working version of some software I&amp;rsquo;ve&#xA;wanted to tackle for a while. I call it tcjblog.py. It&amp;rsquo;s a blog platform built&#xA;using &lt;a href=&#34;http://jemdoc.jaboc.net/&#34;&gt;jemdoc.py&lt;/a&gt; to format simple text files into&#xA;nice looking HTML. What&amp;rsquo;re the benefits of this, and features of tcjblog.py in&#xA;general?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Simple, text file management of blog posts. (I control these with git.)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Ability to include LaTeX markup.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Static HTML for all blog-related pages&lt;/p&gt;</description>
    </item>
    <item>
      <title>Pylab PDF</title>
      <link>https://traviscj.com/blog/post/2010-05-25-pylab_pdf/</link>
      <pubDate>Tue, 25 May 2010 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2010-05-25-pylab_pdf/</guid>
      <description>&lt;p&gt;I’m in the process of kicking the MATLAB habit and replacing it with Python. Pylab is a reasonable approximation to the 2D plotting capabilities of MATLAB, but by default Pylab doesn’t run on headless(ie, non-GUI) boxes. So on my macbook, where I’m often running things interactively, I have&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;backend : macosx&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and on the faster core2quad machine I send off longer-running jobs to, I used&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;backend : PDF&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;in the .matplotlib/matplotrc file.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MySQLdb module in Python on Ubuntu</title>
      <link>https://traviscj.com/blog/post/2009-05-30-mysqldb_module_in_python_on_ubuntu/</link>
      <pubDate>Sat, 30 May 2009 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2009-05-30-mysqldb_module_in_python_on_ubuntu/</guid>
      <description>&lt;p&gt;To install the mysqldb module in python on Ubuntu:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt-get install python-mysqldb&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Computer Ressurection and Elastic Cloud Experimentation</title>
      <link>https://traviscj.com/blog/post/2008-11-29-computer_ressurection_and_elastic_cloud_experimentation/</link>
      <pubDate>Sat, 29 Nov 2008 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-11-29-computer_ressurection_and_elastic_cloud_experimentation/</guid>
      <description>&lt;p&gt;I was home on Thanksgiving Break with Sharvil, and we decided to revive some old computers. Partly I&amp;rsquo;d like to experiment with some clustering stuff without incurring CPU time at the AMATH department or Teragrid stuff I&amp;rsquo;m likely gonna be working on soon with Shea-Brown&amp;rsquo;s neuroscience research. So, it turns out I resurrected about 5-6 old computers(final tally is still waiting on the number of successful Xubuntu installs on them, among other practical issues(where the hell am I going to put six computers&amp;hellip;?): The very first computer I built(a P3 450), P3 700, Dual P2 266, a couple of AMD64 3200&amp;rsquo;s, and a Sony Vaio P3 733. The cool thing is that the neuron spiking models are basically embarassingly parallel(well, each run isn&amp;rsquo;t necesarily, but from what I&amp;rsquo;ve gathered so far, we&amp;rsquo;re looking for averages over a bunch of them. So, sweet! Again, this would be terrible for actual research, especially against something like TG or even Amazon&amp;rsquo;s EC2&amp;ndash;which is another thing I really need to check out.&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>
