<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brian Shaler on Medium]]></title>
        <description><![CDATA[Stories by Brian Shaler on Medium]]></description>
        <link>https://medium.com/@brianshaler?source=rss-79ed77eee811------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pOUQEl6zPFXvf78DFb5zPw.jpeg</url>
            <title>Stories by Brian Shaler on Medium</title>
            <link>https://medium.com/@brianshaler?source=rss-79ed77eee811------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:58:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brianshaler/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[On-the-Fly Video Rendering with Node.js and FFmpeg]]></title>
            <link>https://medium.com/@brianshaler/on-the-fly-video-rendering-with-node-js-and-ffmpeg-165590314f2?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/165590314f2</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Wed, 24 Feb 2016 23:15:38 GMT</pubDate>
            <atom:updated>2016-02-24T23:26:35.157Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*UyK4YOerYRwKPxAl9o66WA.png" /></figure><p>Today, <a href="http://carvana.com/">Carvana</a> launched a <a href="http://www.carvana.com/cardianangel">vehicle valuation tool</a> that uses dynamic video, rendered and streamed on-the-fly, to walk people through the factors contributing to a fair market trade-in value for their cars in a fun and approachable way.</p><p>Once given a few details about a vehicle, Carvana retrieves data from various 3rd parties, calculates a value, constructs a timeline from over 100 video clips, and delivers a single video containing all kinds of personalized information.</p><p>If you want more fluff, go read the press release. The rest of this post is about the technology behind the scenes.</p><h4>Why Node.js?</h4><p>First, let’s get this out of the way. A variety of languages, tools, and combinations thereof can be used to render video on a server. This post is not about Node.js being the only way or even the best way to do this.</p><p>Even though Node is wicked fast, it won’t be as fast as something written in assembly or running on a GPU. Node’s performance, event-driven I/O, and seamless interaction with stdin and stdout as native streams made it a valid choice, but one capability stood out to make it invaluable for a project like this. With the right abstractions, most Node code can be effortlessly packaged to run in the browser with minimal effort. This means this project got a free visual IDE by merely placing a text editor next to a <a href="http://livereload.com/">LiveReload</a>-enabled web browser. Sure, I could not interactively drag an item to change its position like a truly “interactive” environment, but I could change its x- and y-coordinates in code, save, and immediately see the result.</p><h4>One Frame at a Time</h4><p>The program powering each video segment is a function that takes three primary inputs: the dataset containing values to present in the video; the frame number to render; and a reference to a canvas to draw on.</p><p>In a web browser, this outputs the desired frame onto a &lt;canvas&gt; element for visual preview.</p><p>On the server, <a href="https://github.com/Automattic/node-canvas">node-canvas</a> provides an identical drawing API that maps to an image manipulation utility called Cairo. The resulting Canvas object can then generate an output stream that can be piped to the file system, a web server response, or in my case, a child process’s stdin.</p><h4>Streaming to the Encoder</h4><p><a href="http://ffmpeg.org/">FFmpeg</a>, the swiss army knife of multimedia, can be spawned as a child process from within Node and configured to wait for data to be provided via stdin. From the shell, it’s more or less like doing this:</p><pre>$ # in a directory full of cat photos<br>$ cat *.jpg | ffmpeg -f image2pipe -i - cats.gif</pre><p>From Node, you can use the child_process native module’s spawn() method to create an object with a writable stream as the .stdin property and a readable stream as the .stdout property. Then to stream multiple frames, you use node-canvas’s Canvas.jpegStream() method, write ‘data’ events to your childProcess.stdin, and intercept the ‘end’ event to start the next frame’s jpegStream. If you simply pipe the stream (“Canvas.jpegStream().pipe(childProcess.stdin)”) the ‘end’ event from the first frame will be passed to stdin and FFmpeg will not receive any further frames. When you are finished with the last frame, you manually close the childProcess.stdin stream to tell FFmpeg the video is complete and to wrap it all up.</p><p>It’s not rocket science, but it’s a clever enough composition to be wowed seeing it in action.</p><h4>Where does it go?</h4><p>Unlike the shell command above, writing to an output file might not be the desired end-game if you want on-the-fly streaming. Just as the child process can take an input stream, the output can be directed to an output stream, stdout.</p><p>In Node, we can pipe the output from FFmpeg to disk, in case we get a head start or need to handle client reconnects. The nice thing about Node streams, however, is they’re quite malleable. You can arbitrarily start, stop, fork, join, or sequence streams. Say you take a video stream, split it into blocks, stream each block to a new file, and store the partial contents of the current block in memory. To fulfill a web request, you can stream the contents of each completed file from the file system to the web server’s response object one at a time (omitting the ‘end’ event, like above), then synchronously write the contents of the current block, then fork the FFmpeg child process’s stdout and pipe it to the web server’s response object. The fact this works without missing or corrupting data is outright silly and amazing. There are perks to having a single-threaded event loop!</p><h4>If only it was that easy..</h4><p>This post was intended to describe a novel use of a few technologies. Sadly, the path to making a production-ready service is littered with obstacles. FFmpeg requires some combination of luck and witchcraft to configure the perfect composition of parameters to work in non-typical scenarios. Cairo, node-canvas, and Cairo’s dependencies can have problems with the wrong combination of platform or version numbers, especially when trying to use custom fonts. HTML5 video is a garbage fire of different codecs and silent failures if anything isn’t quite right. Scaling and load balancing instances in AWS is easy compared to managing your own hardware, but is still no small task (such as avoiding volume initialization when starting instances based on a snapshot). Monitoring render performance, resource utilization, playback experience, system health, and routing logs and exceptions from ephemeral instances with real-time visualizations and automated self-healing is a zoo of scripts, utilities, and plumbing.</p><p>At the end of the day, if you get it all just right, you can plug in some information and within a few seconds begin watching a video made just for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=165590314f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Calculating Confidence]]></title>
            <link>https://medium.com/@brianshaler/calculating-confidence-1c032060a2fd?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c032060a2fd</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Fri, 23 Oct 2015 20:43:56 GMT</pubDate>
            <atom:updated>2015-10-23T20:43:56.130Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5mJEBBBbJfazQ6BoVCIWA.jpeg" /><figcaption>via manoftaste-de on flickr</figcaption></figure><p>A few years ago, an open data meetup group I co-organized started collaborating on a document digitization project. Given thousands of pages of scanned forms, we wanted to extract certain values and analyze them. The form structure was predictable, albeit inconsistent and distorted (possibly fed through a fax machine, rather than a flatbed scanner). Instead of trying to use OCR on the entire document, we found the form borders and lines, sliced up individual fields, and ran them through OCR individually. By isolating the text, we could use the entire OCR output instead of trying to figure out which characters in the output corresponded to which areas of the page. With OCR values for individual fields, our plan was to compare the output with a pattern validator for each field, such as dollar amounts, city names, states, street addresses, and so on. If the value matches the pattern, there would be a pretty high level of confidence the OCR result was successful, in addition to the confidence metric reported by the OCR program. More importantly, a mismatch meant the OCR likely failed, even if it felt confident in its result. We planned to crowdsource a small portion of the overall dataset, starting with fields that failed or had a low confidence rating. This would allow us to maximize the impact of very limited volunteer resources by allowing humans to skip the 80% or so of transcriptions we would expect the OCR system to get right.</p><p>Accurately assessing confidence can be more valuable than coming up with an answer. A computer’s guess will rarely be 100% confident or accurate. Even with an extremely high level of confidence, say 95%, if you don’t know <em>which</em> 5% might have been wrong, your result set may be wildly inaccurate.</p><p>In the pattern matching case, you could call it adding a <em>sanity check</em> to further enhance an existing level of confidence. A sanity check is a great way to flag known-bad results. If a secondary system agrees with the conclusion of a primary system, such as a pattern matching an OCR result, the primary system’s confidence level could then be increased.</p><p>Some confidence-based systems work by returning any number of results with corresponding confidence levels, which you would sort from high to low. Without full context, a primary system’s most confidence result may not be the correct one. Ambiguity needs to be reduced using additional context.</p><p>An example of this is topic recognition in natural language processing. Provided a piece of text that contains the word “apple,” you may expect to find many entities, including a type of fruit and an organization formally known as “Apple, Inc.” A naive keyword lookup may yield a higher confidence for the fruit because it was an exact match. To improve the confidence ranking, other terms from the input text can be compared to documents related to each entity in the result set. Using <em>term frequency-inverse document frequency</em> a new set of confidence levels could be calculated. Any additional context or metadata can help refine confidence.</p><p>Depending on the application, incorrect guesses have different consequences. Fortunately, it’s often easier to flag an answer as incorrect than it is to determine it is correct.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c032060a2fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Privacy Transaction]]></title>
            <link>https://medium.com/@brianshaler/the-privacy-transaction-3f44b0deb7db?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f44b0deb7db</guid>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Fri, 23 Oct 2015 12:59:58 GMT</pubDate>
            <atom:updated>2015-10-23T12:59:58.414Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*isrGh7H0FyQ0BC3szxzPqA.jpeg" /><figcaption>via dave_see on flickr</figcaption></figure><p>According to privacy advocates, relinquishing your personal data to third parties is a bad thing. Merely the possession of your data by a third party is tantamount to surrendering your right to privacy. What if you trust that third party? If it’s impossible to trust Facebook or Google, who <em>can</em> you trust with your private data?</p><p>Many people don’t take these concerns very seriously or even stop to consider them at all. Worse, most people are unaware of the extent to which they are being tracked or the quantity of data being stored, making them woefully unprepared to accurately asset their risk.</p><p>This sounds bad and scary, but ultimately it comes down to trust. With giant, publicly traded companies, there is generally a financial incentive to earn and maintain that trust.</p><p>Subconsciously or not, people are performing a transaction where they buy some kind of capability and pay for it with their privacy.</p><h4>The Equation</h4><p>When determining whether or not to share private data with a third party, you will likely consider the cost/benefit balance of few factors: the benefit provided by the third party in return for the data versus trustworthiness, the level of intimacy of the data, and the magnitude of the consequences of exposure. If the benefits outweigh the costs, a person will give their private data to a third party. Where people draw the line is entirely subjective and is not always based on an informed assessment of each factor.</p><p>Often, the choice of whether or not to give up private data is the choice between having access to a feature, install an app, or connect with friends. This conveys a technically incorrect assumption—implying the capabilities are only possible by using a third party—which sways the equation in favor of sharing private data.</p><p>Each of the costs are typically underestimated.</p><p>Companies may genuinely try to be trustworthy, but there is always the possibility data will be shared, sold, or <a href="https://en.wikipedia.org/wiki/2012_LinkedIn_hack">stolen</a>. This means trustworthiness may be high, but cannot be 100%.</p><p>People underestimate the intimacy of the data they share because they often are unaware of the scale or the scope of data collection practices, such as constant location monitoring, “like” buttons and ads/trackers scattered across the web, text analysis, passive machine learning, and combinations thereof. It is safe to assume companies under-utilize the data and access they have, but it is also safe to assume many companies do more with what they have than the average person can even imagine.</p><p>Those who make the <a href="https://en.wikipedia.org/wiki/Nothing_to_hide_argument">nothing to hide argument</a> show they underestimate the consequences of lost privacy. In addition to common critiques of the fallacy, having nothing to hide <em>now</em> does not guarantee the data, which is likely stored and backed up indefinitely, won’t come back to haunt you in the future. The risk may be low, but it seems like it cannot be zero.</p><p>Even if you personally decide the benefits outweigh the costs, there is a non-zero risk being taken when it is probably not technically required. The problem, for me, is less that trusting third parties is a bad thing so much as it’s often unnecessary.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f44b0deb7db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What if personal web sites were web applications?]]></title>
            <link>https://medium.com/@brianshaler/what-if-personal-web-sites-were-web-applications-623067a35e67?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/623067a35e67</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[blogging]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Thu, 22 Oct 2015 02:04:36 GMT</pubDate>
            <atom:updated>2015-10-22T02:04:36.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LaXpUcj6osVU5TQ7UIn2Dw.jpeg" /><figcaption>via glennf on flickr</figcaption></figure><p>I was experimenting with a React-powered blogging engine, and instead of spending a ton of time to make something that is equivalent to existing blogs, I wanted to see if I could build something new and novel.</p><p>It’s no small feat to build the foundation of for a blog that includes server-side rendering, pushState single page app functionality, flexible custom layout and theme support, embedded widgets, and markdown rendering (well, that last one is pretty trivial). But what’s the goal of all that? To show a chronological list of text entries and photos? Provided a foundation capable of building robust web applications like Facebook and GMail, why settle for functionality that feels so… Web 1.0?</p><p>This train of thought got me pondering the possibilities of what a blog could look like in the web application age. I don’t have the answer, but have some ideas.</p><p>Unlike a list of seldom-updated blobs of text, a web application implies a number of things: dynamism, personalization, and interactivity. To power almost anything along those lines, you’ll first need some sort of authentication scheme, as you would probably want access controls and perhaps even allow user input to be persisted somehow.</p><p>But then what?</p><p>It seems like a personal site should contain a journal (a list of text entries, or a traditional blog) but should also incorporate other types of things one would want to share, such as individual thoughts (microblogging), multimedia, geospatial content (trips you’ve taken, restaurants you’ve reviewed), and so on. As you branch out to other types of data, sorting chronologically starts to detract from telling a story. A web application would allow you to aggregate content in different ways, based on time, location, or topic. The way content is presented may also be different for each of those aggregations.</p><p>Beyond primitive media types and attributes (text, photo, video, audio, location), we can also explore more complex ways of sharing and interacting with content. If we had an easy way to share embeddable interactive components, anyone’s person site could contain interactive features like you might see on nytimes.com, except with data selected or personalized by the author.</p><p>Then, if your site’s components can be interactive, why not also make them collaborative? What if you could allow your friends to add places to visit to a map or list? What if you could upload raw videos and videos, and then work together with your friends to edit them into a final video? What if we could host our own fitness tracker leader boards and track our progress against our friends no matter which manufacturer each has? File sharing, document editing, messaging, and all sorts of services we use could live under one roof, allowing extensions to bridge the gaps between different types of content, or new ways of presenting, interacting with, and collaborating on content.</p><p>And to think that started with wanting to create yet another homebrew blogging engine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=623067a35e67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decentralized Network Graphs]]></title>
            <link>https://medium.com/@brianshaler/decentralized-network-graphs-bd2ff0962eef?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd2ff0962eef</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[social-network]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Wed, 21 Oct 2015 04:25:13 GMT</pubDate>
            <atom:updated>2015-10-21T04:25:13.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RAVP9H-q3DP54h8aRYd4jw.png" /><figcaption>drew some lines over <a href="https://www.flickr.com/photos/respres/2221093511/">an image from respres on flickr</a></figcaption></figure><p>I’ve been thinking about how we access content our friends share online and how we could do it without requiring centralized repositories of data. Decentralization is not so much a feature as it’s a way to achieve a higher level of <a href="https://medium.com/@brianshaler/personal-computation-96211c319148#.u0gu03cgz">personalization</a>. Instead of a central authority managing the entire graph, each node in the graph could be the authority of its own data and immediate connections with a cache of what is known of the graph one or more steps out. Each node could distribute data (push) or query (pull) any number of steps.</p><p>This raises some interesting challenges and possibilities.</p><p>As far as I know, there aren’t any database servers or methodologies designed to distribute data in this way. Keeping data accurate and up to date across partitioned systems is tricky, and would likely require business logic middleware for authentication and filtering. I’ve experimented with distributing public keys and using signatures to verify data was provided by the entity with authority over that data, even if it didn’t come from that entity itself. Outbound filtration would involve only sharing friends’ data with 3rd parties you trust and acknowledging friends’ privacy preferences. Inbound filtration would prevent unnecessary data from being persisted and verify authority over the data being added, updated, or removed.</p><p>Once those problems are handled at the framework level, a very exciting world opens up.</p><p>When you land in a new city, imagine having a list of the top-rated places to visit in categories you care about based on ratings, reviews, tips, and activity from not only your friends, but your extended network. Ideally, each node would <a href="https://medium.com/@brianshaler/a-platform-for-mashup-artists-d562726dfb0b">aggregate and normalize the corresponding person’s activity across rating services</a> (Yelp, Foursquare, Google+/Maps/Places, etc).</p><p>Machine learning requires a lot of training data before yielding meaningful results. What if training data could be distributed, so a friend of a friend can say <em>Don Draper</em> is an entity that relates to another entity, <em>Mad Men</em>, and the next time a friend tweets about <em>Don Draper</em>, your system already knows to add it to your <em>Mad Men</em> stream or remove it if you’ve blocked TV-related posts.</p><p>Just about any factual data could be fragmented and distributed in this way. While I would love for everyone to have their own local, query-able copy of Wikipedia, OpenStreetMap, and any other open dataset, it’s more practical to only store and index the portions that relevant to the individual. It could be articles about entities you’ve tweeted about, street data in your local city, venue information (address, open hours, whether or not wifi is provided), topic and entity relations (like the <em>Mad Men</em> example above), hiking trails and biking paths, and who knows what else. Each of these only gets more interesting as you expand it beyond your own data to that of your friends and then to your extended network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd2ff0962eef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Interface]]></title>
            <link>https://medium.com/@brianshaler/the-interface-6708f97051d2?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/6708f97051d2</guid>
            <category><![CDATA[future]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Tue, 20 Oct 2015 01:04:58 GMT</pubDate>
            <atom:updated>2015-10-20T01:04:58.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8B_Hgk9OWM0vjAzExhprjA.jpeg" /><figcaption>via a6u571n on flickr</figcaption></figure><p>An interface is defined as the interaction between two systems. An application interface is the point of interaction between a human and a computer. Thinking of it as an interaction helps break free from thinking an interface is simply what you look at or how it looks.</p><p>The interfaces of the future won’t differ solely in color scheme, strokes or gradients, icons or text, or pixels on a screen. They will interact with us in new ways.</p><p>In the last ten years, we’ve begun to interact with technology in new and interesting ways, far beyond typing and clicking. Speech recognition, while still limited and error prone, has finally become practical to use. Multi-touch interfaces have enabled all kinds of gestures. Google took a stab at a heads up display with Google Glass. Apple recently added Force/3D Touch to many of their products. Video game consoles have adopted alternative inputs, like Nintendo’s Wiimote and Microsoft’s Kinect.</p><p>The most interesting interface to me, though, is the smartwatch, because of what it can tell us about the future of interfaces. Design-wise, my first generation Pebble (the <a href="https://www.kickstarter.com/projects/597507018/pebble-e-paper-watch-for-iphone-and-android">Kickstarter project now known as Pebble Classic</a>) is not very pretty. But as an interface, it is beautiful. When I receive a notification, I can glance at my wrist and know instantly whether it must be dealt with immediately or not at all. The best feature of the watch is that it allows me to use my phone <em>less</em>. Instead of opening a message in a prettier app, I don’t have to open it at all. That is the best interface.</p><p>The movie <em>Her</em> shows people interacting with an artificially intelligent “operating system” using a bluetooth-like ear piece. What’s interesting is how the visual interface is shown to be nearly entirely gone. Only when there is a photo to view or text to read or write, people fall back to desktop computers or mobile devices. If you need to find or recall something, you ask and the system answers. If you need something that requires research, the system will get back to you when it has an answer. When there is something new to be informed of, the system alerts you. Unlike notifications with today’s technology, the system can defer notifications while you’re busy, asleep, or disconnected. That last point is something I’ve thought about while listening to music on my phone. If only there was a way for my phone to be aware of the urgency of messages and wait until in between songs to alert me of things that aren’t urgent.</p><p>While we will surely continue to experiment with new types of peripheral devices, the hardware is only part of the challenge. Software still has a long way to go to make sense of the data coming in and out, learning about our current context and availability, and connecting the dots between all the systems at play.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6708f97051d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Platform for Mashup Artists]]></title>
            <link>https://medium.com/@brianshaler/a-platform-for-mashup-artists-d562726dfb0b?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/d562726dfb0b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[plugins]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Sun, 18 Oct 2015 23:49:09 GMT</pubDate>
            <atom:updated>2015-10-18T23:49:09.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utzivfwhiJVVfpOoh8ZP_g.jpeg" /><figcaption>suddenly realizing my code will never be as awesome as this image</figcaption></figure><blockquote>“I make stuff move with code.”</blockquote><p>When people ask me what I do, that’s what I say. I don’t say I’m a framework author. I don’t say I’m a systems administrator or database administrator. I don’t say devops or infrastructure. I don’t say development tooling. I don’t say optimization.</p><p>I say eye candy. Pretty pictures. Interactivity. Programmatic animation. Data visualization.</p><p>Ten years ago, in the early days of what we were beginning to call “social media” (back when <em>media</em> in <em>social media</em> meant <em>news</em>), discovered I could use public APIs to build front-end only projects that consumed data from web services and did fun things with them. Sometimes, I needed to run a query that was not the result of a simple API call, so I needed to fetch data, store it somewhere, and then query against my copy of the data. Then, these APIs started introducing restrictions like rate limiting and cumbersome authentication schemes.</p><p>As time went on, it became more and more difficult to build 3rd party mashups of data from social networks and other web services. By 2010, after acquiring client apps for most major platforms, Twitter took its 3rd party developer hostility to the next level by placing harsh limits on whether and how 3rd party applications could store or display content. Build something for Twitter and you could easily find yourself locked out, all that work for nothing.</p><p>What does this new landscape mean for someone like me? It means I need to put additional work into authorization; manage ever changing API documentation for authentication, parameters, and result schemas; do the part I’m actually good at, the front-end; and then hope after all that my access does not get suddenly get revoked due to an unseen hurdle in the complex and restrictive API Terms of Service. And what if you want to make a mashup of multiple web services? Rinse and repeat that process a few times.</p><blockquote>“Build the framework you want to see in the world.”</blockquote><blockquote>— Mahatma Gandhi’s nephew who’s really good at computers</blockquote><p>What I wanted was a way to make mashups, animations, tools, and visualizations without needing to worry about web service authorization or data acquisition. Let one person (me, at first) solve the problem of connecting to a web service and normalizing its data and then forget about it. After an API has been added, I should only have to worry about how to query the local cache and present it.</p><p>With a extensible foundation, I could take it a step further. Plugins could register hooks to further transform data before it gets saved (such as analyzing text content for topics or entities). They could also provide local API endpoints that multiple front-end views could share. The front-end view could be the result of the <a href="https://medium.com/@brianshaler/extensibility-and-declarative-programming-ff2e22b81fe7">composition of a series of complementary plugins</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ix4qb9zF16_4_3MSzgNR8Q.jpeg" /><figcaption>Two travel visualization plugins powered by the same local API endpoint</figcaption></figure><p>For example, if I wanted to make a calendar travel report (left) or a travel map (right), I would first need to know where I was throughout the year(s). Assuming I have one or more social network API plugin, I could query my local cache for geotagged posts, no matter where they were originally posted, using a plugin that analyzes every calendar date and guesses which metropolitan area I was in that day (aside: time zones suck). Because the data imported from social media might not be 100% accurate, it would also need to provide a way for me to make a few corrections. Then, with the geotagged posts normalized and, if necessary, manually corrected, an API endpoint could expose the daily travel history for any number of derivative plugins to use.</p><p>It’s often not worth the trouble for a 3rd party developer to build the entire stack just to build one front-end view. It’s also not very likely for people to sign up to some 3rd party’s web service, grant the developer access to personal data, and then remember it exists days after the first use. As a stand-alone service, it’s not very viable.</p><p>If these were features you could simply add to an <a href="https://medium.com/@brianshaler/personal-computation-96211c319148">existing system</a>, it would be an entirely different equation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d562726dfb0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data is Everywhere]]></title>
            <link>https://medium.com/@brianshaler/data-is-everywhere-4492f4f79b58?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/4492f4f79b58</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[social-network]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Sun, 18 Oct 2015 22:13:42 GMT</pubDate>
            <atom:updated>2015-10-18T22:13:42.148Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tibBxouifyvnfzd5QjBUVw.jpeg" /><figcaption>via aaddaamn on flickr</figcaption></figure><p>The popular term <em>Big Data</em> represents the collection, storage, processing, and analysis of vast quantities of data. At its simplest, it represents a shift in perspective to the belief that just about any piece of data can provide value. More data is better than less data. The trend is mainly apparent in areas like business intelligence and government surveillance, but if you look closely, you can see signs of big data on a personal level.</p><p>Fitness trackers log every step of every day (okay, often rolled up into 15+ minute intervals) to provide intelligence on your health, progress, and individual workouts. Using a location based social network to “check in” or rate places yields personalized recommendations. By scanning every email in a GMail account, Google Now can provide automatic reminders for appointments, travel, bills, and more. On many social networks, creating a social graph (connections to friends) results in all data from each connection being combined to surface relevant trends and recommendations.</p><p>By providing our data, whether a sensor, access to an account, or information about who we know, people get to easily—and often <em>automatically</em>—reap the benefits of certain types of data analysis.</p><p>The problem is too much data is being ignored and we don’t have any ways to prevent meaningful, relevant data from falling through the cracks.</p><p>The most obvious area of improvement is location. Location based social networks showed how valuable it can be to know where your friends are. The problem is they only help if everyone actively “checks in” on the same social network. You can see if your friends have checked in nearby, but not if they’ve posted a geotagged post nearby via Twitter or Instagram. Instead, that metadata is lost, missed, forgotten.</p><p>Generally, I care more about the words my friends are tweeting and the photos they are sharing than the metadata on those posts, but more data is better than less data.</p><p>The root of the problem is silos. Twitter could add location tools to the Twitter app, but it would only work for the subset of my friends that are tweeting. And why would they add that extra functionality to Twitter in the first place? Twitter is not a location based social network.</p><p>In order to get value from this content and metadata people are sharing online in one place or another, one must first exfiltrate the data from each silo. Then, geographic data can be analyzed for trends or anomalies based on your current location, text content can be grouped, filtered, or emphasized based on your interests, photos can be browsed in a photostream or gallery, and any type of data could be searched, queried, summarized, grouped, filtered, or highlighted.</p><p>We have quite a few useful and magical big data tools operating invisibly on our (and our friends’) data, giving us amazing new insights, alerts, and suggestions. But what they provide is dwarfed by what is possible, at our fingertips, and only just barely out of reach.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4492f4f79b58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extensibility and Declarative Programming]]></title>
            <link>https://medium.com/@brianshaler/extensibility-and-declarative-programming-ff2e22b81fe7?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff2e22b81fe7</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[plugins]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Sat, 17 Oct 2015 23:06:15 GMT</pubDate>
            <atom:updated>2015-10-19T02:45:14.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QxT-2rZfv7MlgOAr5G-bQ.jpeg" /><figcaption>Kyle May — Flickr</figcaption></figure><blockquote>When you have a hammer, everything looks like a nail.</blockquote><p>When I first got into CoffeeScript, one of the main factors that got me over my resistance to learn a foreign (Ruby-inspired) syntax was that it provided a way to use prototypal inheritance without manually typing `MyObject.prototype.method` or endlessly worrying about what `this` currently means. In a surprising twist, the feature that got me into CoffeeScript is one I no longer use. Instead of writing OOP I have started writing in a more functional style, and have found CoffeeScript to be equally powerful (fat and skinny arrow function shorthand, implicit returns, fewer curly braces and parentheses to close, etc). ES6 has added `class` syntax sugar, but for me, it is a feature I will generally avoid in either language.</p><h4>Imperative Extensibility</h4><p>In developing a foundation for an extensible application, I started with a base plugin with helper functions. Plugins would import the base plugin class and call those helper functions to change configuration. From a framework perspective, the goal should be to minimize boilerplate—code that is identical in every place a feature is used. Boilerplate wastes the time of plugin authors, and increases the complexity of plugins with code that is not unique to the problem being solved by the plugin. Helper functions are a great way to reduce boilerplate in an imperative system.</p><h4>Boilerplate and Housekeeping</h4><p>Boilerplate is not the only concern. Plugin authors should also be spared of as much housekeeping as possible. Housekeeping is the management of state, through operations to add, update, or remove objects (configuration, functions, etc). In an imperative system, a plugin author is responsible for performing the operations required to add functionality to the system, but must also be concerned with updating or removing functionality. These operations are made even more complex with dependencies, as the order of the operations matters. Suddenly, leaving housekeeping up to the plugin author can turn into a massively complex and error-prone system.</p><h4>Functional Design in an Imperative World</h4><p>After studying functional programming languages and concepts, it became clear to me that a more graceful way of handling extensibility and mitigating complexity would be to forgo the object prototype-based imperative approach in favor of a declarative approach.</p><p>For a plugin author, the result would not be too different, boilerplate-wise. However, housekeeping would be dramatically different. Instead of performing operations to add or configure functionality, plugins would declare functionality and the framework would be responsible the housekeeping.</p><p>The filesystem can be used as boilerplate in a declarative system. That is, by simply being in a specific directory, a file may be defining what it is for or how it should be utilized. This is common with MVC frameworks, where files within a `controllers` directory imply `filename.ext` should handle a request to `/filename` or files within a `models` directory inform the framework to create tables or collections in a database where the table or collection name is the same as the file name.</p><p>By composing an object or positioning files in a hierarchy, a plugin simply describes how something is supposed to be. The housekeeping—how to add, update, or remove functionality, and in what order—is left up to the framework.</p><p>In my primitive proof-of-concept, I took very naive approaches for each part of the system — configuration, event handling, web service route definitions. I also made decisions based on language features in Javascript, like the deep merging of nested objects.</p><p>For configuration, a plugin may be designed to have an extensible list by storing a default value in an object `{stuff: {default: ’Default’}}` such that a separate, independent plugin could add an item to that list by specifying `{stuff: {newItem: ’New Item’}}` and allowing the framework to construct the final list by merging the declarations into `{stuff: {default: ’Default’, newItem: ’New Item’}}`. If sort order is important, they could be defined as a more robust object, like `{stuff: {default: {value: ‘default’, display: ‘Default’, sort: 1}}}`.</p><h4>Drawbacks</h4><p>The way I designed my architecture, a plugin would synchronously return an object with its configuration. For flexibility, I added an asynchronous initialization function that, if provided, would be called after all configurations had been loaded. The most obvious need for something like this was for configuration that was dependent on an asynchronous resource, such as a database call. A different way to address that problem would be to provide a way for a database query to be expressed in the synchronous result and rely on the framework to trigger the database query and embed the results. Ultimately, I wanted to support other types of asynchronous configuration, and wanted the framework to be decoupled from knowledge of a database (which is itself provided by a plugin).</p><p>With a blog, you may have multiple themes installed, and thus selectable in a list, but you will want to store the currently selected theme in a persistent data store. This means a plugin cannot declare “the current blog theme is ME.” This is not necessarily a problem with a declarative design, so much as it’s an age-old challenge with the combination of synchronous and asynchronous systems. Static declaration can only get you so far before you find yourself needing dynamic configuration.</p><p>I also worry that by doing things in a different way may alienate plugin authors who are more accustomed to imperative systems, even if they necessitate more complex housekeeping.</p><p>Ultimately, I’m very happy with the reduction of complexity I have been able to achieve through this shift in thinking from imperative to declarative designs.</p><p>I am curious if there is any literature on the design of extensible systems. There are pros and cons to each method, but perhaps people have discovered clever ways of getting around drawbacks in the declarative approach.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff2e22b81fe7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Singularity and Forward Progress]]></title>
            <link>https://medium.com/@brianshaler/the-singularity-and-forward-progress-976af0fdbdcc?source=rss-79ed77eee811------2</link>
            <guid isPermaLink="false">https://medium.com/p/976af0fdbdcc</guid>
            <category><![CDATA[singularity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Brian Shaler]]></dc:creator>
            <pubDate>Sat, 17 Oct 2015 03:30:27 GMT</pubDate>
            <atom:updated>2015-10-17T03:30:27.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d6WQZyCKsVvOdkAEgN6IFw.jpeg" /><figcaption>The Pinwheel Galaxy — NASA</figcaption></figure><p>In technology, singularity can be defined as the point in which an artificially intelligent computer, network, or robot is capable of recursively improving itself, leading to a runaway affect of rapid advancement. Another take on it—and I’m not precisely sure how I came to associate the term singularity—is the point in which a computer or network exceeds the computational capacity of the human brain.</p><p>There are two ways of looking at this milestone, which we may or may not be able to call a singularity. Hardware and software.</p><h4>Hardware</h4><p>At what point will we be able to construct a single system that matches the processing potential of all the neurons in the brain. Given some derivative of Moore’s Law or perhaps even a conservative estimate of how many transistors we’ll be able to cram into a single system, with or without advancements in materials or architecture, we can come up with a practical estimate of when it will be possible to build a computer with the physical computing power of the human brain.</p><p>As digital transistors and analog neurons are not directly comparable, I don’t think we can put a specific number of operations per second as a target. The fastest networked clusters of computers we have today, collectively referred to as supercomputers, may already exceed the raw processing power of a single human mind. It may be 5–20 years before the same capacity is available in an individual system, and only if major breakthroughs are made in construction, design, and energy consumption. We are already seeing that the future gains will likely be in concurrency rather than faster serial operations, which means programs that can be broken down into simpler tasks and distributed simultaneously to many cores will benefit more.</p><p>Ultimately, with hardware, progress will continue to march forward.</p><h4>Software</h4><p>With software, things are not so straightforward. While improvements and optimizations are made, progress is not so steady. Even if we have the physical infrastructure to mimic a human brain, what software would we run on it? Managing complexity, detecting patterns, efficiently storing and recalling memories, and making decisions are very difficult challenges.</p><p>State-of-the-art software can use substantial computing power, and yet still struggle with basic challenges despite being specifically designed for that one task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMHDuKI7w1xusPFisfSFOw.jpeg" /><figcaption>No, computer, this is not a cat.</figcaption></figure><p>Some software improves steadily and incrementally. Far too many others don’t. For every long-running project that steadily improves against benchmarks (such as operating systems, video game engines, Javascript engines in web browsers, etc.), many more are simply shuttered, re-written in new languages or for new frameworks with marginal improvements, or not ported to new architectures or platforms.</p><p>There is a thriving open source community, contributing to software at every level of the stack, but more development time is spent on closed source, proprietary software that will no longer benefit society after the organization decides to shut it down or replace it. And, by nature of being proprietary, if another organization seeks to provide functionality similar to another organization—competitor or not—it must spend resources on recreating the same functionality.</p><p>Programming language specific package managers are perhaps the best way we have to isolate functionality and make it available for use in any other projects, or even compose multiple other packages to create higher-level functionality. Another great option is containerizing standalone services, which can transcend programming language. A Ruby Gem is nearly useless for a Node.js project, but a containerized service can be utilized just as easily by a Python project just as easily as a Go project. That is, until you upgrade your kernel or lxc container software…</p><p>We are making progress, but far too often, our progress feels like two steps forward and one step back. If anything, what we need most is to make progress on improving how we make progress in software.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=976af0fdbdcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>