<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Nathan Lawrence</title>
    <description>Web developer, photographer and documentary filmmaker. Writing code to make public media more awesome.
</description>
    <link>http://www.nathanlawrence.org/</link>
    <atom:link href="http://www.nathanlawrence.org/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 03 Nov 2016 17:28:57 +0000</pubDate>
    <lastBuildDate>Thu, 03 Nov 2016 17:28:57 +0000</lastBuildDate>
    <generator>Jekyll v3.3.0</generator>
    
      <item>
        <title>Scrolling-Motivated D3 Demo: An Introduction to Averages</title>
        <description>&lt;p class=&quot;disclaimer&quot;&gt;This post is written as an example of what it might look like to tell a story using D3 that reacts as you scroll. This kind of effect can definitely be over-used, but it's great for stories when you're walking a reader through how you might have analyzed data, since it can visually clarify a process for someone even if they've never encountered statistics before.&lt;/p&gt;

&lt;p class=&quot;disclaimer&quot;&gt;(Yes, I'm aware most people know how averages work, this just made a good demo.)&lt;/p&gt;

&lt;p&gt;If you're new to the world of statistics, one of the first concepts that's likely to be thrown around all the time is the concept of an average value. This may seem like a pretty straightforward thing to calculate or discuss, but there are actually a number of different things this can refer to.&lt;/p&gt;

&lt;p&gt;The most common kinds of averages you'll encounter are the median and the arithmetic mean.&lt;/p&gt;

&lt;p class=&quot;before-main-chart&quot;&gt;To demonstrate these, let's work on a bar chart of a random set of nine numbers:&lt;/p&gt;

&lt;div class=&quot;chart&quot; id=&quot;main-chart&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;main-chart-placeholder&quot;&gt;&lt;/div&gt;

&lt;p class=&quot;after-main-chart&quot;&gt;These are generated on the fly each time this page loads. In this particular instance, they range from &lt;span class=&quot;set-lowest&quot;&gt;&lt;/span&gt; to &lt;span class=&quot;set-highest&quot;&gt;&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;Now, let's take a look at some averages. First up is &lt;strong&gt;the median&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The first recorded use of the median as a term was as early as the fourteenth century, but it really rose to promise as a maritime navigational tool when Edward Wright wrote about it in his book &lt;cite&gt;Certaine Errors in Navigation&lt;/cite&gt;.&lt;/p&gt;

&lt;p&gt;Put most simply, the median means the middle of the data. Let's calculate one.&lt;/p&gt;

&lt;p id=&quot;order-chart&quot;&gt;First, we'll take our randomly generated numbers and sort them by size. (This will happen as you scroll.)&lt;/p&gt;

&lt;p id=&quot;color-median&quot;&gt;Next, let's choose the value of the middle column. It's our median. In this case, that's &lt;span class=&quot;set-median&quot;&gt;&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;As the name implies (and as you can see), medians are the middle of the data set, but not necessarily the middle of the values associated with something. Medians are frequently used for navigation or when it's particularly important to have your average item be a member of the original data set.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p id=&quot;un-color-median&quot;&gt;But let's not leave the chart shaded and sorted! It's time to move on.&lt;/p&gt;

&lt;p&gt;Next, let's talk about &lt;strong&gt;mean&lt;/strong&gt;. The mean of a data set is typically what people are talking about when they refer to an &quot;average&quot; in a more general context. Usually, it's calculated by taking the sum of all items in a data set and then dividing by the number of items. Unlike median, this is unlikely to result in an &quot;average&quot; that is also a member of your data set.&lt;/p&gt;

&lt;p&gt;The easiest way to visualize this is to imagine that we are taking parts of each bar in the chart above and distributing them equally until all the bars have the same height. That height is then the mean.&lt;/p&gt;

&lt;p id=&quot;demonstrate-mean&quot;&gt;Let's try it now!&lt;/p&gt;

&lt;p&gt;Hopefully, this little tutorial has given you a better idea of how averages might work. For more information, you might want to try the Wikipedia pages for &lt;a href=&quot;https://en.wikipedia.org/wiki/Median&quot;&gt;median&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Mean&quot;&gt;mean&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And, of course, for more information on how to assemble scrolling-driven stories like this, stay tuned here!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;../../../../../js/posts/intro-to-averages.js&quot;&gt;&lt;/script&gt;</description>
        <pubDate>Sat, 30 Apr 2016 07:13:33 +0000</pubDate>
        <link>http://www.nathanlawrence.org/data-visualization/d3/2016/04/30/intro-to-averages.html</link>
        <guid isPermaLink="true">http://www.nathanlawrence.org/data-visualization/d3/2016/04/30/intro-to-averages.html</guid>
        
        
        <category>data-visualization</category>
        
        <category>d3</category>
        
      </item>
    
      <item>
        <title>Adventures in Home Automation - Part One</title>
        <description>&lt;p&gt;After months of deliberation, I’ve finally taken the plunge and invested in a &lt;a href=&quot;https://shop.smartthings.com/#!/kits/samsung-smartthings-home-monitoring-kit&quot;&gt;SmartThings starter kit&lt;/a&gt;. If you’re not comfortable programming, there is still a lot of room for improvement, but the start is strong enough that you can really see where this system is going and what we can expect in the future.&lt;/p&gt;

&lt;p&gt;The starter kit, which SmartThings calls the “Home Monitoring Kit,” comes with a motion sensor, two “multi-purpose” sensors (which can measure temperature, position and whether or not a door is closed) and a smart outlet adapter in addition to a basic hub that’s required to connect all the components.&lt;/p&gt;

&lt;p&gt;The hub plugs in to your existing router, then your pair your individual “Things” to it in a way that’s quite reminiscent of Bluetooth. This is where things get a little more complicated. Sometimes, this pairing process can take a very long time to work properly, and sometimes it just doesn’t work at all. With these four “Things,” all packaged with the SmartThings hub and guaranteed to work with it, I still found myself spending over an hour in this pairing process. The multi-purpose sensors in particular seemed to give me a lot of trouble: One took more than five minutes to appear to the hub, and another paired immediately, but would never say the door was closed.&lt;/p&gt;

&lt;p&gt;Eventually, I got these kinks worked out by un-pairing (which SmartThings perplexingly calls “device exclusion”) and re-pairing the sensors, but this just shouldn’t happen. If I were a less determined or technically minded person, I might have driven back to Best Buy and abandoned this endeavour.&lt;/p&gt;

&lt;p&gt;That said, now that everything is working, I’m very happy with things. I only have one lamp responding to my actions right now, but it has already significantly improved my quality of life. I’ve bought some third-party components to test as well, and I’ll update here as I learn more about how they work.&lt;/p&gt;
</description>
        <pubDate>Mon, 14 Mar 2016 07:13:33 +0000</pubDate>
        <link>http://www.nathanlawrence.org/home-automation/2016/03/14/adventures-home-automation-part-one.html</link>
        <guid isPermaLink="true">http://www.nathanlawrence.org/home-automation/2016/03/14/adventures-home-automation-part-one.html</guid>
        
        
        <category>home-automation</category>
        
      </item>
    
      <item>
        <title>Introducing the Markdown Cheat Sheet</title>
        <description>&lt;p&gt;After a couple of weeks of work on it in my off-time, I’m pleased to finally introduce my own implementation of an interactive &lt;a href=&quot;http://www.mdcheatsheet.com&quot;&gt;Markdown Cheat Sheet&lt;/a&gt; to the world.&lt;/p&gt;

&lt;p&gt;In case you’re not familiar with Markdown, it’s a lightweight markup language with syntax designed to get out of the way when you need to write with minimal distractions. It was created by &lt;a href=&quot;https://daringfireball.net/&quot;&gt;John Gruber&lt;/a&gt; and &lt;a href=&quot;http://www.rememberaaronsw.com/memories/&quot;&gt;Aaron Swartz&lt;/a&gt;, but has since expanded far beyond the reaches of its original intended use cases to become a part of some of the world’s most popular open source projects, including Jekyll, which runs this site. In my day-to-day work at &lt;a href=&quot;http://www.kbia.org&quot;&gt;KBIA&lt;/a&gt;, I use Markdown all the time, and I’ve been trying to persuade more and more of the news team here to give it a try.&lt;/p&gt;

&lt;p&gt;Unfortunately, there &lt;em&gt;is&lt;/em&gt; a slight learning curve. Though Markdown’s syntax and structure starts to feel very natural after a while, it initially can feel very arbitrary and strange. Even though I’ve been using it since I was writing papers in college, I still find myself having to look up some of the more esoteric elements whenever I need them, and that can be a real pain.&lt;/p&gt;

&lt;p&gt;John Gruber provides his own Markdown syntax guide, but it’s on the long side, and seems more than a little daunting at first. Github provides one as well, but if you know exactly what you’re looking for, this still involves a shocking amount of clicking and browsing before you stumble onto what you wanted to find in the first place.&lt;/p&gt;

&lt;p&gt;The goal of my Markdown Cheat Sheet is to completely eliminate this problem. Instead of searching through dozens of smaller pages about specific kinds of syntax, a Markdown novice or a generally forgetful person (like me) can just go to &lt;a href=&quot;http://www.mdcheatsheet.com&quot;&gt;mdcheatsheet.com&lt;/a&gt; and start typing what they’re looking for. Through the magic of JavaScript, the cheat sheet will narrow itself down and show only what they are interested in knowing about at that second. This takes a two-minute job and reduces it to ten seconds.&lt;/p&gt;

&lt;p&gt;The Markdown Cheat Sheet is written in Angular JS, version 1.4.8. Eventually, I could see myself upgrading this stack to Angular 2, but I just don’t see the need to do that tomorrow. Angular allowed me to put this together in a relatively small time with very little performance overhead, and thanks to its built-in requests engine and data binding, I’m able to store the table of Markdown syntax as a JSON file and add to it when a user requests more information.&lt;/p&gt;

&lt;p&gt;Like all my mini-projects, The Markdown Cheat Sheet is 100% free and open-source. You can view the code &lt;a href=&quot;http://www.github.com/NathanLawrence&quot;&gt;on my GitHub page&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Fri, 15 Jan 2016 19:13:33 +0000</pubDate>
        <link>http://www.nathanlawrence.org/web/journalism/development/2016/01/15/introducing-markdown-cheat-sheet.html</link>
        <guid isPermaLink="true">http://www.nathanlawrence.org/web/journalism/development/2016/01/15/introducing-markdown-cheat-sheet.html</guid>
        
        
        <category>web</category>
        
        <category>journalism</category>
        
        <category>development</category>
        
      </item>
    
  </channel>
</rss>
